Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #7141
| From | Quintus <quintus@quintilianus.eu> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | Re: Error displaying accented Italian |
| Date | 2015-09-20 21:30 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <87y4g099d0.fsf@hades.cable.internal.west-ik.de> (permalink) |
| References | <ms8s8o$9a4$1@speranza.aioe.org> |
There are multiple possible causes for this problem. 1) Your text file is not encoded in UTF-8. You need to check that your editor/IDE (i.e. NetBeans) saves the file in UTF-8. 2) Your editor’s output windows is not set up for UTF-8 output. You need to reconfigure your IDE to expect your program’s output in UTF-8. 3) You are using the Windows commandline (DOS box). You need to change the Windows commandline’s configuration to UTF-8 instead of Windows-1252. Background: Windows systems in western countries by default work with the Windows-1252 encoding, which is a variant of ISO-8859-1. Both of these encodings are incompatible with Ruby’s default encoding, which is UTF-8. When you try to display a UTF-8-encoded text in a textbox that expects its input to be Windows-1252, you’ll receive the results you got. The proper solution is to change the output program to expect UTF-8, which is the correct modern-day encoding to use rather than the archaic Windows-* encodings from the 90ies, which is what I have recommended above. It is AFAIK also possible to have Ruby automatically transcode everything to Windows-1252, but I don’t know how. Also, UTF-8 can contain many more characters then Windows-1252, and it is likely that sooner or later you run into problems with characters that can’t be represented in Windows-1252. Hence, the better solution is to change your tooling to expect UTF-8. Valete, Quintus. -- #!/sbin/quintus Blog: http://www.guelkerdev.de GnuPG key: F1D8799FBCC8BC4F
Back to comp.lang.ruby | Previous | Next — Previous in thread | Find similar
Error displaying accented Italian bughiman <tex_willwr@invalid.com> - 2015-09-03 09:18 +0200 Re: Error displaying accented Italian Quintus <quintus@quintilianus.eu> - 2015-09-20 21:30 +0200
csiph-web