To show or not to show french accents
francis.girard at free.fr
francis.girard at free.fr
Fri Dec 19 08:06:42 EST 2003
Hello,
> What I don't understand is why you want show for this. As I
> mentioned earlier, to output strings and get accented
> characters, all you have to do is to output the string with
> putStr, and voilà, les signes diacritiques.
Sometimes, I want to do cheap and dirty test programs that "shows" data
structures involving some strings. Again, the cheap and dirty way to do this is
to derive the data structure from "Show" using the "deriving" keyword. But
then, you are sometimes barely able to just read the outputed string.
Therefore I have to redefine "show" myself ... Which is a lot less cheap and a
lot more dirty.
> The problem is that if you are reading single bytes, 233 is
> not necessarily é. It might be 'shch' if you are in Russia,
What the byte should represents is not relevant here. All I wanted to point
out, is that it is easier to read a character as a one byte (or two) instead of
4 and translate 4 characters into a numerical value, NO MATTER WHAT THE BYTE IS
SUPPOSED TO REPRESENT. This was to answer an opposition that was maintaining
that "show" was meant to be "Read". I simply answered that that was not a valid
argument.
> arithmetic right). Since Haskell specifies unicode, if you
> are operating in a Russian locale that's what ought to
> happen.
I naively tought that unicode would solve these kind of problems. But yet we're
stucked with these pesky 7 bits ...
Regards,
Francis Girard
LE CONQUET
France
Selon Jon Fairbairn <Jon.Fairbairn at cl.cam.ac.uk>:
> On 2003-12-18 at 16:40+0100 francis.girard at free.fr wrote:
> > Good evening,
> >
> > OK. I don't know Haskell enough to argue.
> >
> > But I can't resist pointing out that reading a single byte
> > having the value 233 (that is 'é')
>
> The problem is that if you are reading single bytes, 233 is
> not necessarily é. It might be 'shch' if you are in Russia,
> or iota if you are in Greece. While it's (almost) completely
> reasonable to expect 233 to display as é in Western Europe,
> it's completely unreasonable to hold that expectation across
> borders.
>
> > is certainly simpler than reading the four characters
> > "\233", parse it, and translate it into a single byte
>
> but it isn't a single byte internally. Indeed, if you are in
> Russia you could reasonably expect reading a single byte 233
> to be converted to the internal code 1257 (if I got the
> arithmetic right). Since Haskell specifies unicode, if you
> are operating in a Russian locale that's what ought to
> happen.
>
> What I don't understand is why you want show for this. As I
> mentioned earlier, to output strings and get accented
> characters, all you have to do is to output the string with
> putStr, and voilà, les signes diacritiques.
>
> Jón
>
>
> --
> Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk
>
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>
More information about the Glasgow-haskell-users
mailing list