First of all, I'd like to apologize because I know that my question probably has very simple answer and that it has been answered somewhere in this forum. I have found a few posts that deal with it, but somehow the solution still eludes me.
I have a simple Java application that I'm developing with Eclipse and SWT. One of the features in the application is reading data from a text file and displaying it on the label.
Data is not in English and it uses some non-standard characters, for instance "čekić". The application reads this word and writes out "?eki?". Even if I put in the code itself "label.setText("čekić")" it still displays those darn question marks.
I have tried many things but I simply cannot make it write these characters properly. Can someone PLEASE tell me, like I'm a 5-year old, what exactly do I have to do to display this chars correctly. Please help me people, I'm going nuts here.
The word "čekić" is a croatian word meaning "hammer". The first letter is pronounced "ch" as in "change". The last sounds simmilar but is spoken more softly - like the first syllable in a spoken italian word "ciao". The closest pronounciation would be "checkeech" (but not "check-eech", you must say those two parts together with the first part slightly accentutated, like the words "baby" or "happy"). There, todays lesson in Croatian language is over.
As for the soultion I still don't have one and am still asking for help . I have found an interim solution which is breaking every word into characters and inserting a Unicode instead of the actual special character. It works, but is awfully inelegant and cumbersome. [ April 14, 2005: Message edited by: Mortimer Mousse ]
1. When you see the '?' instead of another character that you expect, it means that the encoding system used to read the bytes could not figure out what the bytes should be mapped to. '?' means encoding problem
2. If you see the square box instead of the character you expect, then it usually means that the font you are using to display the characters does not have a representation for the character that you need to display.
As for solutions, I suggest the following:
1. Try setting the label statically with unicode at compile time to see if you can get it to look right. For example
2. When reading in the characters from the file, make sure that you read the bytes from the file using the correct encoding. For example: