From: mortee Date: 2007-10-31T04:57:53+09:00 Subject: Re: to_yaml and international characters Jamal Bengeloun wrote: > Probably. I am a beginner in ruby. > > The program gets the accented characters from a dBaseIV file, a MS > Access File and some YAML files. > > I use Komodo Edit as my editor and it does handle UTF-8 correctly. > > I know! That's why I did not understand why I got \202. I do not know > which charset ruby uses to convert the characters. When converting some accented characters to \nnn then it doesn't use any encoding. It just represents the verbatim non-ascii bytes it sees in the string it gets. Encodig/decoding happens mainly when you input accented chars on your keyboard, and they get converted to some byte (-sequence) to be stored in a string, and when those strings are displayed, and they are converted back to some printable characters. Problems arise when the displaying code interprets the same string according to a different charset than what it was encoded according to. For example, when you puts a string in irb, then it's your terminal's current charset which determines how the bytes in the string are actually displayed. In contrast, when you use p (or, for that matter, inspect), then non-ascii characters get ascaped as \nnn. mortee