Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > default encoding of a jvm

Reply
Thread Tools

default encoding of a jvm

 
 
Kihup Boo
Guest
Posts: n/a
 
      07-15-2003
how can i get the default encoding value of a jvm or a system?

- Ki


 
Reply With Quote
 
 
 
 
Joseph Millar
Guest
Posts: n/a
 
      07-15-2003
On Tue, 15 Jul 2003 08:53:06 -0400, "Kihup Boo" <> wrote:
> how can i get the default encoding value of a jvm or a system?


System.getProperty("file.encoding");

On my XP system, it yields "Cp1252", on my Linux box it's "UTF-8".
Based on your language and region, you will get different values
(maybe).

--Joe
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      07-15-2003
On Tue, 15 Jul 2003 08:53:06 -0400, "Kihup Boo" <>
wrote or quoted :

>how can i get the default encoding value of a jvm or a system?


see http://mindprod.com/jgloss/encoding.html
hint: it is not DEFAULT !!!


--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
X_AWieminer_X
Guest
Posts: n/a
 
      07-17-2003
>>how can i get the default encoding value of a jvm or a system?
>
> see http://mindprod.com/jgloss/encoding.html
> hint: it is not DEFAULT !!!


This little trick should tell you the JVM-OS default encoding. More
transparent implementation would use a os-generated temporary file and
then delete it. Most likely utility class with a static value would
create a temp file on first method invocation and then reuse that value.

I dont know whether we could use FileReader to achieve the same encoding
value.

private String getDefaultCharSet() throws IOException {
FileWriter filewriter = new FileWriter("out");
String encname = filewriter.getEncoding();
filewriter.close();
return encname;
}

 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      07-22-2003
On Tue, 15 Jul 2003 08:53:06 -0400, "Kihup Boo" <>
wrote or quoted :

>how can i get the default encoding value of a jvm or a system?


check out Wassup which displays the system properties. Every but he
kitchen sink is in there somewhere.

http://mindprod.com/wassup.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
String default encoding: UTF-16 or Platform's default charset? cs_professional Java 14 12-12-2010 05:10 PM
default encoding UTF 8? Roger Pack Ruby 1 05-25-2010 03:51 AM
different default encoding ? dt1649651@yahoo.com Java 2 01-31-2006 07:31 PM
Default encoding Florian Lindner Python 1 08-01-2004 10:18 PM
Encoding.Default and Encoding.UTF8 Hardy Wang ASP .Net 5 06-09-2004 04:04 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57