codepage issue?

Hi.

I'm having problems reading non english characters from an inputStream (file)

The encoding on my phone is "iso 8859-1"

I'm havig this problem long time, mainly because "solved" it in a ugly way.

EDITED: Sorry, this code was working for just one char :(

InputConnection connection = (InputConnection) Connector.open(archivo, Connector.READ);

InputStream dis = connection.openInputStream();

(while .....)

ch = is.read();

if (ch < 0) ch = ch + 256;// <-- !!!!

Then "(char) ch" returns the correct char...

can someone tell the correct way to solve this please?

Thanks.

Message was edited by:

Munzuk

[796 byte] By [Munzuka] at [2007-10-3 5:05:13]
# 1
The big question here is: what is the encoding of your inputstream data?
deepspacea at 2007-7-14 23:11:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

Thanks for reply

Files are ISO-8859 (or so says the "file" command), I thing it must be ISO-8859-15, since is my system default

tried to force the inputstream to ISO-8859-15 and UTF-8, but seems that my phone doesn't accept any other than ISO-8859-1 (of these three is the only that doesn't throw an exception)

Maybe I must write the files for reading in ISO-8859-1, but don't know how to do that, maybe by changing the system configuration... huh, no way.

atm im working with this... ugly but working:

[CODE]

private int tratarChr(int chr) {

if (chr==-31) chr=225; // ?br>if (chr==-23) chr=233; // ?br>if (chr==-19) chr=237; // ?br>if (chr==-13) chr=243; // ?br>if (chr==-6) chr=250; // ?br>if (chr==-63) chr=193; // ?br>if (chr==-55) chr=201; // ?br>if (chr==-51) chr=205; // ?br>if (chr==-45) chr=211; // ?br>if (chr==-38) chr=218; // ?br>if (chr==-15) chr=241; // ?br>if (chr==-47) chr=209; // ?br>if (chr==-30) chr=226; // ?br>if (chr==-22) chr=234; // ?br>if (chr==-18) chr=238; // ?br>if (chr==-12) chr=244; // ?br>if (chr==-5) chr=251; // ?br>if (chr==-62) chr=194; // ?br>if (chr==-54) chr=202; // ?br>if (chr==-50) chr=206; // ?br>if (chr==-44) chr=212; // ?br>if (chr==-37) chr=219; // ?br>

//if (chr==-) chr=239; // ?br>//if (chr==-) chr=252; // ?br>//if (chr==-) chr=207; // ?br>//if (chr==-) chr=220; // ?br>return chr;

}

[/CODE]

Munzuka at 2007-7-14 23:11:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3
Hi,Have u tried with readUTF() and writeUTF() functions Regards @rjun
arjunamatea at 2007-7-14 23:11:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4
Hi,Have u tried with readUTF() and writeUTF() functions Regards @rjun
arjunamatea at 2007-7-14 23:11:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...