tor 2002-08-08 klockan 15.12 skrev Axel Simon:
On Thu, Aug 08, 2002 at 02:58:42PM +0200, Martin Norbck wrote:
There rarely should be a need to handle UTF-8 text internally in Haskell, but for FFI it would be neccessary. Using locale automatically there is wrong, since gtk2 uses UTF-8 always, and other interfaces uses iso-8859-1 always. However, having some conversion functions could never hurt, but they need not be in the FFI.
Sure it is necessary to explicitly state what kind of conversion you want when you talk to your C library. So IMHO the only question that really remains is whether readFile, withCString and all other standard I/O function should assume UTF-8 by default or the current locale. I opt for the latter.
Since readFile and writeFile handles Strings, they must be locale dependent. Should they fall back to the most common 8-bit format (iso-8859-1) or throw an excaption when encountering illegal multi-byte sequences? Regards, Martin -- Martin Norbäck d95mback@dtek.chalmers.se Kapplandsgatan 40 +46 (0)708 26 33 60 S-414 78 GÖTEBORG http://www.dtek.chalmers.se/~d95mback/ SWEDEN OpenPGP ID: 3FA8580B