Results 1 to 4 of 4
Thread: Encoding Problems in JRE
- 02-25-2011, 08:23 PM #1
Member
- Join Date
- Dec 2010
- Posts
- 19
- Rep Power
- 0
Encoding Problems in JRE
Hello forum, I Have a strange problem regarding Character Encoding while running in JRE, I need to save in a text file some text and I have some special characters in it for control reasons, for ex. the char ( ◙ ).
My problem is that while this works when I run my program through the NetBeans, when I try to run the Jar file with JRE the Special characters become the (TM) char.
Why do you think that happens ?
Thanks in advance.
- 02-25-2011, 09:52 PM #2
Member
- Join Date
- Feb 2011
- Posts
- 1
- Rep Power
- 0
I might be totally wrong, but have you tried specifically selecting the character encoding for output? I had this problem when I passed some commandline args[] to program and they turned out odd. I solved the problem using PrintStream. Like so:
System.out.println("C:\\DO.EXE " + args[0]);
--> prints out badly, C:\DO.EXE "Ei mõõritelty"
message = "C:\\DO.EXE" + args[0];
PrintStream ps = new PrintStream(System.out, true, "Cp852");
ps.println(message);
--> prints out correctly, C:\DO.EXE "Ei määritelty"
Sun Java Supported Character Encodings
- 02-26-2011, 03:16 PM #3
Member
- Join Date
- Dec 2010
- Posts
- 19
- Rep Power
- 0
You might be right, I don't set a character encoding and maybe there are different defaults in sdk and in JRE,
this is the code that saves the file, can anyone tell me how to set the character Encoding ?Java Code:final Transformer t = TransformerFactory.newInstance().newTransformer(); OutputStream outputStream = new FileOutputStream(XmlFilePath); t.transform(new DOMSource(document), new StreamResult(outputStream));
- 02-28-2011, 09:13 AM #4
Member
- Join Date
- Dec 2010
- Posts
- 19
- Rep Power
- 0
Similar Threads
-
Need encoding for Korean
By RamaNalayini in forum Advanced JavaReplies: 1Last Post: 11-25-2010, 02:34 PM -
arabic encoding in url
By echoe_echoe in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 10-06-2010, 08:10 AM -
problem in encoding
By jaysh in forum NetBeansReplies: 0Last Post: 08-26-2010, 08:07 AM -
Encoding Problem
By GJ! in forum Advanced JavaReplies: 6Last Post: 01-12-2010, 08:09 PM -
Some help with encoding...
By nm123 in forum NetworkingReplies: 0Last Post: 04-15-2008, 12:22 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks