Skip to content
This repository was archived by the owner on Dec 5, 2019. It is now read-only.

Null-terminate Text bytestrings #33

Merged
merged 1 commit into from
Nov 2, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ObjectiveHaskell/NSString.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fromNSString obj = do
-- | Converts a 'Text' value into an immutable @NSString@.
toNSString :: Text -> IO Id
toNSString txt =
let arr = ByteString.unpack $ encodeUtf8 txt
let arr = (ByteString.unpack $ encodeUtf8 txt) ++ [0]
in withArray arr $ \ptr ->
getClass "NSString" >>= stringWithUtf8String (castPtr ptr)

Expand Down