[Haskell-cafe] Core packages and locale support

Roman Beslik beroal at ukr.net
Sun Jun 27 03:11:59 EDT 2010


  On 27.06.10 03:58, Felipe Lessa wrote:
> On Sun, Jun 27, 2010 at 02:55:33AM +0300, Roman Beslik wrote:
>>   On 26.06.10 15:44, Felipe Lessa wrote:
>>> However, suppose your program needs to create a file with a name
>>> based on a database information.  Your database is UTF-8.  How do
>>> you translate that UTF-8 data into a filepath?  This is the
>>> problem we got in Haskell.  We have a nice coding-agnostic String
>>> datatype, but we don't know how to create a file with this very
>>> name.
>> It is simple — you recode from (database | "network server" | file)
>> encoding to the current locale.
> Recoding is indeed very simple.  You know the source coding
> (e.g. your database is in UTF-8).  But how do you discover the
> target coding?  How can you find out that this system uses
> ISO8859-1, while this other one uses UTF-16, while...?
>
> See the problem now? :)
No! The target encoding is the current locale. It is a no-brainer to 
find it. Use your Unix.
$ man setlocale
$ locale

-- 
Best regards,
   Roman Beslik.



More information about the Haskell-Cafe mailing list