
On 11-12-04 07:08 AM, dokondr wrote:
In GHC 7.0.3 / Mac OS X when trying to:
writeFile "someFile" "(Hoping You Have A iPhone When I Do This) Lol Sleep Is When You Close These ---> \55357\56384"
I get: commitBuffer: invalid argument (Illegal byte sequence)
The string I am trying to write can also be seen here: http://twitter.com/#!/search/Hoping%20You%20Have%20A%20iPhone%20When%20I%20D... http://twitter.com/#%21/search/Hoping%20You%20Have%20A%20iPhone%20When%20I%2...
\55357 and \56384 would be surrogates D83D and DC40 for use in UTF-16 only. Haskell's Char is not a UTF-16 code unit (unlike early versions of Java and probably current ones). GHC is correct in rejecting them. Haskell's Char is a Unicode character directly. If you want the character U+1F440 "EYES", write \128064 directly (or \x1f440, or \x1F440). Use http://www.unicode.org/charts/ to find out what you are getting into. You can enter a hexadecimal number or choose a category.