Re: problem with java, ASCII and Linux



fcastillo@xxxxxxxxxxxxx said:
>I has a Linux RedHat 9.0 with a jre1.5.0_04 (rpm package of Sun).
>
>I has a problem with ASCII , for example :

No, you have a problem with non-ASCII characters. ASCII is US-ASCII,
a-z, numerics and a small set of punctuation and special characters.

>import java.io.*;
>
>
>public class HolaMundo
>{
>public static void main (String[] args)
>{
>System.out.println("Holá Múndo");
>}
>}

.... so, two non-ASCII characters.

>this programs runs ok on my windows jdk so it prints "Holá Múndo",
>but when i run the same HolaMundo.class program on my linux redhat it
>prints "Holá Múndo"

Appears that you have some partially utf-8 -based environment.
That is, your environment states that you're using utf-8 as your
character encoding, and Java outputs sequences that would, in
true utf-8 environment provide the letter glyphs you were expecting.
Instead, your terminal emulator chooses to display the output in
some other encoding, perhaps iso-8859-1.

It used to be possible to force the encoding used by applications
with a system property named file.encoding, but at least the
tests I ran just now seem to indicate that the system property
is overridden by the locale environment variables.

You'll need to tell (by using LC_CTYPE environment variable)
to your Java VM which character encoding is used by your terminal
emulator. If it's iso-8859-1, you could use something like
LC_CTYPE=es_ES.iso88591 java Hola
to run your program on the command line.

And yes, character set issues (when you're working with anything
but US-ASCII) are a pain. And have been for more than two decades
already.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
.



Relevant Pages

  • Re: regex w allows non english characters
    ... characters as a normal range of chars, with a character encoding. ... what encoding Hebrew uses I'm not sure, but for instance the ascii ...
    (comp.lang.ruby)
  • Re: File-Compare "fc" falsely reports mismatch between identical files
    ... first and last lines of each set of differences, whereas /L is said to compare files as ascii text. ... Show me a couple of "text files" that fc/a does not compare properly, and I would argue that they are so extreme in some way that I would not consider them "text files". ... One of the definitions found by google is this: "A file that contains characters organized into one or more lines. ... the tax department reacted to a customer's complaint and insisted that the faulty tax calculation be fixed. ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: POS. Cash Register on AS400.- New and Updates
    ... Probably the easiest way would be to send them as ASCII. ... You need to change the printer file to not convert unprintable characters. ... "The INITPRT tag defines the ASCII control ... but still can not open cash drawer. ...
    (comp.sys.ibm.as400.misc)
  • Re: Unicode Support
    ... consider:)...but, you know, a file is still just a "stream of characters" ... "escape sequence" but accessing an ordinary ASCII character) are considered ... English, while all your identifiers are in "Romanji" Japanese or something ... NASM appears already to do so with strings and comments in ...
    (alt.lang.asm)
  • Re: System 360 EBCDIC vs. ASCII
    ... I suppose they could have created a 7-bit architecture if it ... There are a few vestiges of 7-bit characters in other computer systems due ... If you set your modem to 8 bits you ... connections, including hardwired ones: plotters, ASCII terminals, etc. ...
    (bit.listserv.ibm-main)