Re: Issue with handling the degree character
Kevin Reid <kpreid-M/[email protected]>
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Message-ID | <[email protected]> |
On Dec 6, 2010, at 3:06, Bill Frantz wrote: > The degree symbol is represented as the single character 0xa1 in > this source. > > > It seems to me that something in either reading the file or the > quasi-parser is converting the degree symbol to a 0x00b0. Also > something is happening to the Unicode value between the source > file and the representation of the constant at run time > expanding it to 5 characters. > > I can live with this issue, but is this what is supposed to happen? Quick notes: $ echo ° | iconv -f utf-8 -t iso-8859-1 | hexdump -C 00000000 b0 0a |?.| $ echo ° | iconv -f utf-8 -t macroman | hexdump -C 00000000 a1 0a |?.| ° is represented as 0xb0 in iso-8859-1 and also U+00B0 as Unicode, and as 0xa1 in MacRoman. Your Java is probably defaulting to MacRoman; this affects E source files as well as file.getText() etc. To change this, java -Dfile.encoding=utf-8 (or whatever encoding you want) rune -J-Dfile.encoding=utf-8 I make no statements here as to what *should* be. -- Kevin Reid <http://switchb.org/kpreid/>