problem with java, ASCII and Linux

This is a discussion on problem with java, ASCII and Linux within the Linux Web Servers forums, part of the Web Server and Related Forums category; Hi Friends, I has a Linux RedHat 9.0 with a jre1.5.0_04 (rpm package of Sun). I has ...


Go Back   Usenet Forums > Web Server and Related Forums > Linux Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-01-2005
fcastillo@hostgreen.com
 
Posts: n/a
Default problem with java, ASCII and Linux

Hi Friends,

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 :
...........
import java.io.*;


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

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"

I think the problem is with the ASCII table that uses the linux version
of jre, but i dont know how to solve this problem. I need a
Spanish-European ASCII table on my application but i think it is
working with a US-ASCII table.

Then i has installed a kaffe 1.0 (rpm) java machie on this linux and
this solve the problem but i has another problems of compatibility with
this old version of java kaffe.

Do you know whats happening?

Thanks in advance.

  #2 (permalink)  
Old 09-01-2005
Tim
 
Posts: n/a
Default Re: problem with java, ASCII and Linux

On Thu, 01 Sep 2005 02:40:14 -0700, fcastillo sent:

> I has a problem with ASCII , for example : ..........
> import java.io.*;
>
>
> public class HolaMundo
> {
> public static void main (String[] args) {
> System.out.println("Holá Múndo");
> }
> }
> ..........
>
> 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"
>
> I think the problem is with the ASCII table that uses the linux version of
> jre, but i dont know how to solve this problem. I need a Spanish-European
> ASCII table on my application but i think it is working with a US-ASCII
> table.
>
> Then i has installed a kaffe 1.0 (rpm) java machie on this linux and this
> solve the problem but i has another problems of compatibility with this
> old version of java kaffe.
>
> Do you know whats happening?


You're right that it's a character set issue, but how you go about
resolving it is something I don't know for your particular case.

When serving webpages, you configure things so that the webserver
explicitly describes the encoding scheme being used with the page (whether
that being setting the server configuration, or authoring the pages to
suit the server configuration).

You'll have to find out what your implementation of Java expects, and
tailor your data to suit; or what it can accept, and configure everything
in a suitable manner.

Specifying an encoding scheme with Apache is simple enough, just putting
a line like this in the configuration file, if you were using utf-8
encoded HTML pages:

AddDefaultCharset utf-8

Then, if you were using Java to include utf-8 into an utf-8 page, all
ought to be fine.

It seems, to me, that it's Java that you need to be checking up on.

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please destroy some files yourself.

  #3 (permalink)  
Old 09-01-2005
Andreas Prilop
 
Posts: n/a
Default Re: problem with java, ASCII and Linux

On 1 Sep 2005 fcastillo@hostgreen.com wrote:

> I need a
> Spanish-European ASCII table on my application but i think it is
> working with a US-ASCII table.


Nobody expects the Spanish ASCII table!

  #4 (permalink)  
Old 09-01-2005
Juha Laiho
 
Posts: n/a
Default Re: problem with java, ASCII and Linux

fcastillo@hostgreen.com 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)
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:46 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0