Re: [Haskell-cafe] UTF-8 in Haskell.

2010-12-26 Thread Magicloud Magiclouds
Thanks for the ideas. In this case, ssh, it is a transfer layer protocol, which means it does not convert anything. For example the server was using ascii, and the client was using ascii, then good. If the client was using UTF-8 instead, then he might get a broken display, ssh itself would not

Re: [Haskell-cafe] UTF-8 in Haskell.

2010-12-26 Thread Antoine Latter
Hi, What would you be using the CString for? A CString is really a lot less useful than a ByteString for almost all purposes. If I allready had a ByteString, the only reason I would want to convert it to a CString is to call a C function. Take care, Antoine On Sun, Dec 26, 2010 at 7:40 PM,

Re: [Haskell-cafe] UTF-8 in Haskell.

2010-12-26 Thread Magicloud Magiclouds
Sorry, I just noticed that I had a misunderstanding here. With encode and bytestring hackages, I think it should be OK for my requirement. On Mon, Dec 27, 2010 at 10:32 AM, Antoine Latter aslat...@gmail.com wrote: Hi, What would you be using the CString for? A CString is really a lot less

Re: [Haskell-cafe] UTF-8 in Haskell.

2010-12-23 Thread Maciej Piechotka
On Thu, 2010-12-23 at 14:15 +0800, Magicloud Magiclouds wrote: On Thu, Dec 23, 2010 at 2:01 PM, Mark Lentczner ma...@glyphic.com wrote: On Dec 22, 2010, at 9:29 PM, Magicloud Magiclouds wrote: Thus under all situation (ascii, UTF-8, or even UTF-32), my program always send 4 bytes through

Re: [Haskell-cafe] UTF-8 in Haskell.

2010-12-23 Thread Max Bolingbroke
On 23 December 2010 05:29, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote:  If so, OK, then I think I could make a packInt which turns an Int into 4 Word8 first. Thus under all situation (ascii, UTF-8, or even UTF-32), my program always send 4 bytes through the network. Is that OK?

[Haskell-cafe] UTF-8 in Haskell.

2010-12-22 Thread Magicloud Magiclouds
Hi, Recently, I am reading ssh hackage (http://hackage.haskell.org/package/ssh). When at the part of deal with string, I got confused. I am not sure if this is a bug for the hackage, or I am just misunderstanding. An ascii char takes a Word8. So this works (LBS stands for

Re: [Haskell-cafe] UTF-8 in Haskell.

2010-12-22 Thread Mark Lentczner
On Dec 22, 2010, at 9:29 PM, Magicloud Magiclouds wrote: Thus under all situation (ascii, UTF-8, or even UTF-32), my program always send 4 bytes through the network. Is that OK? Generally, no. Haskell strings are sequences of Unicode characters. Each character has an integral code point

Re: [Haskell-cafe] UTF-8 in Haskell.

2010-12-22 Thread Magicloud Magiclouds
On Thu, Dec 23, 2010 at 2:01 PM, Mark Lentczner ma...@glyphic.com wrote: On Dec 22, 2010, at 9:29 PM, Magicloud Magiclouds wrote: Thus under all situation (ascii, UTF-8, or even UTF-32), my program always send 4 bytes through the network. Is that OK? Generally, no. Haskell strings are