Re: Writing Unicode-16 to a text file
From: Konrad Den Ende (chamsterkonrad_at_bigfoot.com)
Date: 01/24/04
- Next message: CodeGoneBad: "CodeGuide users?"
- Previous message: Missaka Wijekoon: "Re: Q: Java source and directory structure - 'standard way' ?"
- In reply to: chris: "Re: Writing Unicode-16 to a text file"
- Next in thread: Soren Kuula: "Re: Writing Unicode-16 to a text file"
- Reply: Soren Kuula: "Re: Writing Unicode-16 to a text file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 24 Jan 2004 01:04:06 +0100
> When you wrote the characters to a file (what method did you use?) they
> probably underwent a 16-bit to 8-bit conversion
try {
BufferedWriter writer = new BufferedWriter (new FileWriter
("nihongo.txt"));
writer.write (cc); // cc is a char[] that stores the characters
writer.close ();
}
catch (Exception e) {System.out.println (e.getMessage ());}
> using some encoding (what encoding did you specify? or what is your Java
> installation using as its default encoding?).
I didn't specify any encoding so i guess it's english. BUT i figured that
since
char is not more than a number then my char[] variable is just an array of
some
kind of integers (2-byte, i guess, so it will contain all the 65k
characters).
> When you looked at the file afterwards, the software you used to do that
> (what did you use?) probably wasn't set up to grok that encoding.
I used MS Word and a text reader with enabled japanese. Just to be sure i
checked a file that i can read japanese text from using my usual software,
and read from it using notepad. I didn's see japanese (oh, what a surprise)
but i could see a number of strange characters.
Yet, the file that my application creates, contains only "?"'s.
> What happens when you read the file back into Java?
"?"'s only.
Any hint?
--
Kindly
Konrad
---------------------------------------------------
May all spammers die an agonizing death; have no burial places;
their souls be chased by demons in Gehenna from one room to
another for all eternity and more.
Sleep - thing used by ineffective people
as a substitute for coffee
Ambition - a poor excuse for not having
enough sense to be lazy
---------------------------------------------------
- Next message: CodeGoneBad: "CodeGuide users?"
- Previous message: Missaka Wijekoon: "Re: Q: Java source and directory structure - 'standard way' ?"
- In reply to: chris: "Re: Writing Unicode-16 to a text file"
- Next in thread: Soren Kuula: "Re: Writing Unicode-16 to a text file"
- Reply: Soren Kuula: "Re: Writing Unicode-16 to a text file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|