<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Java Platform Encoding</title>
	<atom:link href="http://happygiraffe.net/blog/2009/09/24/java-platform-encoding/feed/" rel="self" type="application/rss+xml" />
	<link>http://happygiraffe.net/blog/2009/09/24/java-platform-encoding/</link>
	<description></description>
	<lastBuildDate>Sat, 10 Dec 2011 22:23:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Dominic Mitchell</title>
		<link>http://happygiraffe.net/blog/2009/09/24/java-platform-encoding/#comment-536</link>
		<dc:creator>Dominic Mitchell</dc:creator>
		<pubDate>Sat, 10 Dec 2011 22:23:35 +0000</pubDate>
		<guid isPermaLink="false">http://happygiraffe.net/blog/?p=1624#comment-536</guid>
		<description>I&#039;m not entirely sure how filenames are interpreted.  It may well be independent of &lt;tt&gt;sun.jnu.encoding&lt;/tt&gt;.  In &lt;a href=&quot;https://gist.github.com/1456701&quot; rel=&quot;nofollow&quot;&gt;an example&lt;/a&gt; I just concocted, it appears to &lt;i&gt;always&lt;/i&gt; use UTF-8 for filenames on my mac.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not entirely sure how filenames are interpreted.  It may well be independent of <tt>sun.jnu.encoding</tt>.  In <a href="https://gist.github.com/1456701" rel="nofollow">an example</a> I just concocted, it appears to <i>always</i> use UTF-8 for filenames on my mac.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Dell'Aera</title>
		<link>http://happygiraffe.net/blog/2009/09/24/java-platform-encoding/#comment-535</link>
		<dc:creator>John Dell'Aera</dc:creator>
		<pubDate>Fri, 09 Dec 2011 02:31:27 +0000</pubDate>
		<guid isPermaLink="false">http://happygiraffe.net/blog/?p=1624#comment-535</guid>
		<description>For example, I can create files with Greek characters from a terminal via touch and all the UTF-8 characters are displayed correctly.</description>
		<content:encoded><![CDATA[<p>For example, I can create files with Greek characters from a terminal via touch and all the UTF-8 characters are displayed correctly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Dell'Aera</title>
		<link>http://happygiraffe.net/blog/2009/09/24/java-platform-encoding/#comment-534</link>
		<dc:creator>John Dell'Aera</dc:creator>
		<pubDate>Fri, 09 Dec 2011 02:07:20 +0000</pubDate>
		<guid isPermaLink="false">http://happygiraffe.net/blog/?p=1624#comment-534</guid>
		<description>I have a java server app that creates UTF-8 file system names.
Unfortunately, when I look at the file names the non-ascii characters of the file names are displayed with &#039;?&#039;. How do I get the system to display the appropriate UTF-8 character?


System specs:
Linux CentOS 6.0 2.6.18.8-xenU #1 SMP Thu May 13 11:11:51 PDT 2010 x86_64 x86_64 x86_64 GNU/Linux

Tomcat 6
Java 1.6

JAVA_OPTS=-Dsun.jnu.encoding=UTF-8
CATALINA_OPTS=-Dfile.encoding=UTF-8


locale
LANG=en_US.UTF-8
LC_CTYPE=&quot;en_US.UTF-8&quot;
LC_NUMERIC=&quot;en_US.UTF-8&quot;
LC_TIME=&quot;en_US.UTF-8&quot;
LC_COLLATE=&quot;en_US.UTF-8&quot;
LC_MONETARY=&quot;en_US.UTF-8&quot;
LC_MESSAGES=&quot;en_US.UTF-8&quot;
LC_PAPER=&quot;en_US.UTF-8&quot;
LC_NAME=&quot;en_US.UTF-8&quot;
LC_ADDRESS=&quot;en_US.UTF-8&quot;
LC_TELEPHONE=&quot;en_US.UTF-8&quot;
LC_MEASUREMENT=&quot;en_US.UTF-8&quot;
LC_IDENTIFICATION=&quot;en_US.UTF-8&quot;
LC_ALL=


I even execute the following at startup:
        System.setProperty(&quot;file.encoding&quot;, &quot;UTF-8&quot;);
        System.setProperty(&quot;encoding&quot;, &quot;UTF-8&quot;);
        System.setProperty(&quot;user.language&quot;, &quot;en_US.UTF-8&quot;);
        System.setProperty(&quot;user.country&quot;, &quot;en_US.UTF-8&quot;);
        System.setProperty(&quot;sun.jnu.encoding&quot;, &quot;UTF8&quot;);


And where I create the file:
       fullPathName = new String(fullPathName.getBytes(&quot;UTF-8&quot;));
       InputStream is = file.getInputStream();
       input = new BufferedInputStream(is, STREAM_BUFFER_SIZE);
       output = new BufferedOutputStream(new FileOutputStream(fullPathName), 
                                                                           STREAM_BUFFER_SIZE);

       // Read file from memory and write it to disk.
       int r;
       byte[] buf = new byte[STREAM_BUFFER_SIZE];
       while ((r = input.read(buf)) != -1) {
                       output.write(buf, 0, r);
         }

         output.close();
         output = null;
         input.close();
         input = null;</description>
		<content:encoded><![CDATA[<p>I have a java server app that creates UTF-8 file system names.<br />
Unfortunately, when I look at the file names the non-ascii characters of the file names are displayed with &#8216;?&#8217;. How do I get the system to display the appropriate UTF-8 character?</p>
<p>System specs:<br />
Linux CentOS 6.0 2.6.18.8-xenU #1 SMP Thu May 13 11:11:51 PDT 2010 x86_64 x86_64 x86_64 GNU/Linux</p>
<p>Tomcat 6<br />
Java 1.6</p>
<p>JAVA_OPTS=-Dsun.jnu.encoding=UTF-8<br />
CATALINA_OPTS=-Dfile.encoding=UTF-8</p>
<p>locale<br />
LANG=en_US.UTF-8<br />
LC_CTYPE=&#8221;en_US.UTF-8&#8243;<br />
LC_NUMERIC=&#8221;en_US.UTF-8&#8243;<br />
LC_TIME=&#8221;en_US.UTF-8&#8243;<br />
LC_COLLATE=&#8221;en_US.UTF-8&#8243;<br />
LC_MONETARY=&#8221;en_US.UTF-8&#8243;<br />
LC_MESSAGES=&#8221;en_US.UTF-8&#8243;<br />
LC_PAPER=&#8221;en_US.UTF-8&#8243;<br />
LC_NAME=&#8221;en_US.UTF-8&#8243;<br />
LC_ADDRESS=&#8221;en_US.UTF-8&#8243;<br />
LC_TELEPHONE=&#8221;en_US.UTF-8&#8243;<br />
LC_MEASUREMENT=&#8221;en_US.UTF-8&#8243;<br />
LC_IDENTIFICATION=&#8221;en_US.UTF-8&#8243;<br />
LC_ALL=</p>
<p>I even execute the following at startup:<br />
        System.setProperty(&#8220;file.encoding&#8221;, &#8220;UTF-8&#8243;);<br />
        System.setProperty(&#8220;encoding&#8221;, &#8220;UTF-8&#8243;);<br />
        System.setProperty(&#8220;user.language&#8221;, &#8220;en_US.UTF-8&#8243;);<br />
        System.setProperty(&#8220;user.country&#8221;, &#8220;en_US.UTF-8&#8243;);<br />
        System.setProperty(&#8220;sun.jnu.encoding&#8221;, &#8220;UTF8&#8243;);</p>
<p>And where I create the file:<br />
       fullPathName = new String(fullPathName.getBytes(&#8220;UTF-8&#8243;));<br />
       InputStream is = file.getInputStream();<br />
       input = new BufferedInputStream(is, STREAM_BUFFER_SIZE);<br />
       output = new BufferedOutputStream(new FileOutputStream(fullPathName),<br />
                                                                           STREAM_BUFFER_SIZE);</p>
<p>       // Read file from memory and write it to disk.<br />
       int r;<br />
       byte[] buf = new byte[STREAM_BUFFER_SIZE];<br />
       while ((r = input.read(buf)) != -1) {<br />
                       output.write(buf, 0, r);<br />
         }</p>
<p>         output.close();<br />
         output = null;<br />
         input.close();<br />
         input = null;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jayesh Malondkar</title>
		<link>http://happygiraffe.net/blog/2009/09/24/java-platform-encoding/#comment-481</link>
		<dc:creator>Jayesh Malondkar</dc:creator>
		<pubDate>Thu, 19 May 2011 03:20:02 +0000</pubDate>
		<guid isPermaLink="false">http://happygiraffe.net/blog/?p=1624#comment-481</guid>
		<description>The above article was a life-saver for me. We were stuck in an issue where we were not able to set Encoding of the JVM inspite of overridding the LANG variable.
Thus, overridding the sun.jnu.encoding variable was the last resort. However, as rightly pointed out in the above artice, this variable is not well documented in the Java Documentation.

The fine research and detail explanation given by : Dominic Mitchell ; made my day.
Thanks a lot once again and keep up the good work.!!</description>
		<content:encoded><![CDATA[<p>The above article was a life-saver for me. We were stuck in an issue where we were not able to set Encoding of the JVM inspite of overridding the LANG variable.<br />
Thus, overridding the sun.jnu.encoding variable was the last resort. However, as rightly pointed out in the above artice, this variable is not well documented in the Java Documentation.</p>
<p>The fine research and detail explanation given by : Dominic Mitchell ; made my day.<br />
Thanks a lot once again and keep up the good work.!!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

