<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>And now here&#039;s something… &#187; jscience</title>
	<atom:link href="http://christiansons.net/mike/blog/tag/jscience/feed/" rel="self" type="application/rss+xml" />
	<link>http://christiansons.net/mike/blog</link>
	<description>Java, Ant, SVN, Jetty, cygwin and other stuff…</description>
	<lastBuildDate>Fri, 02 Dec 2011 16:53:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>JScience unit formatting</title>
		<link>http://christiansons.net/mike/blog/2008/11/jscience-unit-formatting/</link>
		<comments>http://christiansons.net/mike/blog/2008/11/jscience-unit-formatting/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 00:45:10 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[jscience]]></category>

		<guid isPermaLink="false">http://blog.christiansons.net/?p=18</guid>
		<description><![CDATA[JScience uses Unicode characters in the String representations of some of its Units.  For example, Unicode U+2103 (℃) is used to represent the unit for degrees Celsius.  Those characters can cause problems with fonts and/or platforms (Windows, typically) which do not contain or recognize them.  Instead, you may see a question mark, box, or other <a href='http://christiansons.net/mike/blog/2008/11/jscience-unit-formatting/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><a title="JScience is a Java library for working with scientific measurements." href="http://jscience.org/">JScience</a> uses Unicode characters in the String representations of some of its Units.  For example, Unicode <a title="U-2103" href="http://www.fileformat.info/info/unicode/char/2103/index.htm">U+2103</a> (℃) is used to represent the unit for degrees Celsius.  Those characters can cause problems with fonts and/or platforms (Windows, typically) which do not contain or recognize them.  Instead, you may see a question mark, box, or other unfamiliar glyph.  Here is the symbol for degrees Celsius again &#8212; ℃ &#8212; can you see it properly?</p>
<p>Using <a title="Javadoc for UnitFormat.label()" href="http://jscience.org/api/javax/measure/unit/UnitFormat.html#label(javax.measure.unit.Unit,%20java.lang.String)">UnitFormat.label()</a>, we can override the String representation to something more compatible, useful, or just different.  Here&#8217;s how I changed degrees Celsius to be more compatible with my co-workers Windows systems.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">UnitFormat.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">label</span><span style="color: #009900;">&#40;</span>SI.<span style="color: #006633;">CELSIUS</span>, <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\u</span>00B0&quot;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;C&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>And here&#8217;s how I changed knots to be represented by <tt>kts</tt> instead of the default, <tt>kn</tt>.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">UnitFormat.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">label</span><span style="color: #009900;">&#40;</span>NonSI.<span style="color: #006633;">KNOT</span>, <span style="color: #0000ff;">&quot;kts&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2008/11/jscience-unit-formatting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

