Dealing with Unicode

F

F

Dear all,

I am writing an application where I need to receive text in a
different character set than the normal ascii.
I am supposed to receive string in hebrew and make some computation on
that based on the unicode values of each character.

I was trying some basic code to see how it works but I can't get the
output that I expect. For example:

System.out.println("character value:"+ (int)args[0].charAt(0));

The value in args[0] is a hebrew letter, which should have the Unicode
value between 05D0 and 05FF. However, any value that I give as an
input always returns 63 (the code for the '?').

Can anyone help me?

Kind regards,
F.
 
O

Oliver Wong

F said:
Dear all,

I am writing an application where I need to receive text in a
different character set than the normal ascii.
I am supposed to receive string in hebrew and make some computation on
that based on the unicode values of each character.

I was trying some basic code to see how it works but I can't get the
output that I expect. For example:

System.out.println("character value:"+ (int)args[0].charAt(0));

The value in args[0] is a hebrew letter, which should have the Unicode
value between 05D0 and 05FF. However, any value that I give as an
input always returns 63 (the code for the '?').

Can anyone help me?

Try output to a file instead of standard out. Your console may not be
able to display certain characters, whereas you can always use a
hex-editor to analyze the contents of a file.

- Oliver
 
J

Joshua Cranmer

F said:
Dear all,

I am writing an application where I need to receive text in a
different character set than the normal ascii.
I am supposed to receive string in hebrew and make some computation on
that based on the unicode values of each character.

I was trying some basic code to see how it works but I can't get the
output that I expect. For example:

System.out.println("character value:"+ (int)args[0].charAt(0));

The value in args[0] is a hebrew letter, which should have the Unicode
value between 05D0 and 05FF. However, any value that I give as an
input always returns 63 (the code for the '?').

Can anyone help me?

Kind regards,
F.

What is happening is that the terminal is probably not recognizing the
Hebrew letter when it is inputted. One way to test is to run from
another Java class:

Runtime.getRuntime().exec("java someClass \u05d0");

If that works, it's your terminal that is having the problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top