<?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>Giladon-line &#187; languaget</title>
	<atom:link href="http://giladlotan.com/blog/category/languaget/feed/" rel="self" type="application/rss+xml" />
	<link>http://giladlotan.com/blog</link>
	<description>culture technology: bridging the gap</description>
	<lastBuildDate>Tue, 18 May 2010 00:29:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>UTF-8 J2ME Datastream Implementation</title>
		<link>http://giladlotan.com/blog/2006/11/utf-8-j2me-datastream-implementation/</link>
		<comments>http://giladlotan.com/blog/2006/11/utf-8-j2me-datastream-implementation/#comments</comments>
		<pubDate>Mon, 13 Nov 2006 01:27:40 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[ITP]]></category>
		<category><![CDATA[Mobile App Design]]></category>
		<category><![CDATA[languaget]]></category>
		<category><![CDATA[mobile phone]]></category>
		<category><![CDATA[mososo]]></category>
		<category><![CDATA[travel]]></category>

		<guid isPermaLink="false">http://giladlotan.com/blog/?p=79</guid>
		<description><![CDATA[<p>I&#8217;m trying to get foreign alphabet characters to show up on my mobile phone via a J2ME translation application that I&#8217;m writing.</p>
<p>The biggest hurdle is understanding how unicode works, and creating an http connection that reads UTF-8 bytes.</p>
<p>Step-by-step:</p>

Make sure you have Arial Unicode MS font or any other unicode font.
Update properties file in phone emulator [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m trying to get foreign alphabet characters to show up on my mobile phone via a <a href="http://giladlotan.com/blog/?page_id=35">J2ME translation application</a> that I&#8217;m writing.</p>
<p>The biggest hurdle is understanding how unicode works, and creating an http connection that reads UTF-8 bytes.</p>
<p><strong>Step-by-step</strong>:</p>
<ol>
<li>Make sure you have <a href="http://wiki.tcl.tk/11392">Arial Unicode MS font</a> or any other unicode font.</li>
<li>Update properties file in phone emulator with the wanted unicode font. (as explained here: <a href="http://www.devarticles.com/c/a/Java/J2ME-and-Unicode/1/">Enabling Unicode Charset on the Emulator</a>)</li>
<li>Now its a good time to use a very simple code in order to test if our Unicode Emulator is working. I used this <a id="p92" href="http://giladlotan.com/blog/wp-content/uploads/2006/11/helloworldjap.txt">Hello World Japanese</a> code, and the result was very exciting: <a class="imagelink" title="Hello World Japanese" href="http://giladlotan.com/blog/wp-content/uploads/2006/11/hello-world-japanese.jpg"><br />
</a></p>
<div style="text-align: center"><a class="imagelink" title="Hello World Japanese" href="http://giladlotan.com/blog/wp-content/uploads/2006/11/hello-world-japanese.jpg"><img width="193" height="287" id="image83" alt="Hello World Japanese" src="http://giladlotan.com/blog/wp-content/uploads/2006/11/hello-world-japanese.jpg" /></a></div>
</li>
<li>Next I created a very <a href="http://giladlotan.com/MobileApps/hebrew%20page.htm">simple webpage</a> with some UTF-8 encoded characters (hebrew is easiest for me). I wrote a simple http connection  app, using the following bit of java code &#8211; <a id="p89" href="http://giladlotan.com/blog/wp-content/uploads/2006/11/httpconnection.txt" /><a id="p91" href="http://giladlotan.com/blog/wp-content/uploads/2006/11/httpconnection.txt">UTF8 Http Connection</a>. This is the result I got (hebrew text in the red box):
<div align="left" /><strong> </strong></p>
<div style="text-align: center"><a title="Hebrew on emulator" class="imagelink" href="http://giladlotan.com/blog/wp-content/uploads/2006/11/hebrewutf8.jpg"><img width="190" height="281" alt="Hebrew on emulator" id="image85" src="http://giladlotan.com/blog/wp-content/uploads/2006/11/hebrewutf8.jpg" /></a></div>
</li>
<li><strong> </strong>Tried a few different languages. Got it to work in most common charsets (at least the ones that I need for my translation application). Here is the text in Simplified Chinese Characters: (&#8230; don&#8217;t ask me why, but the text says &#8220;<em>hi my name is gilad&#8230; Do you have some cheese?</em>&#8220;) <a title="simplified chinese" class="imagelink" href="http://giladlotan.com/blog/wp-content/uploads/2006/11/simplified-chinese.jpg"><br />
</a></p>
<div style="text-align: center"><a title="simplified chinese" class="imagelink" href="http://giladlotan.com/blog/wp-content/uploads/2006/11/simplified-chinese.jpg"><img width="194" height="269" alt="simplified chinese" id="image87" src="http://giladlotan.com/blog/wp-content/uploads/2006/11/simplified-chinese.jpg" /></a></div>
</li>
<li><strong> </strong>Next phase is to deploy this simple app onto the Nokia N80. When I tried that I got an &#8220;<em>Unhandled Expression</em>&#8221; error.</li>
</ol>
<p><span id="more-79"></span></p>
<table width="80%" summary="Description of standard charsets">
<tr>
<th>
<p align="left">Charset</p>
</th>
<th>
<p align="left">Description</p>
</th>
</tr>
<tr>
<td valign="top"><tt>US-ASCII</tt></td>
<td>Seven-bit ASCII, a.k.a. <tt>ISO646-US</tt>,          a.k.a. the Basic Latin block of the Unicode character set</td>
</tr>
<tr>
<td valign="top"><tt>ISO-8859-1  </tt></td>
<td>ISO Latin Alphabet No. 1, a.k.a. <tt>ISO-LATIN-1</tt></td>
</tr>
<tr>
<td valign="top"><tt>UTF-8</tt></td>
<td>Eight-bit UCS Transformation Format</td>
</tr>
<tr>
<td valign="top"><tt>UTF-16BE</tt></td>
<td>Sixteen-bit UCS Transformation Format,          big-endian byte order</td>
</tr>
<tr>
<td valign="top"><tt>UTF-16LE</tt></td>
<td>Sixteen-bit UCS Transformation Format,          little-endian byte order</td>
</tr>
<tr>
<td valign="top"><tt>UTF-16</tt></td>
<td>Sixteen-bit UCS Transformation Format,          byte order identified by an optional byte-order mark</td>
</tr>
</table>
<p><strong>Useful functions and classes</strong>:</p>
<ul>
<li><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/io/InputStreamReader.html">InputStreamReader()</a> &#8211;  An InputStreamReader is a bridge from byte streams to character streams: It  reads bytes and decodes them into characters using a specified <a title="class in java.nio.charset" href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html"><code><code>charset</code></code></a>. Each invocation of one of an InputStreamReader&#8217;s read() methods may  cause one or more bytes to be read from the underlying byte-input stream.</li>
<li><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/io/DataInputStream.html">DataInputStream()</a> &#8211; A data input stream lets an application read primitive Java data  types from an underlying input stream in a machine-independent  way.   Data input streams and data output streams represent Unicode  strings in a format that is a slight modification of UTF-8.</li>
</ul>
<p><strong>Useful Links</strong>:</p>
<p><a href="http://java.sun.com/docs/books/tutorial/i18n/text/stream.html">Java tutorial</a> on using unicode</p>
<p><a href="http://developers.sun.com/techtopics/mobility/midp/articles/termemulator3/">MIDP Fonts</a></p>
<p><a href="http://www.unipad.org/download/">Unicode Text Editor</a> software</p>
<dl>
<dd>
<dl> </dl>
</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://giladlotan.com/blog/2006/11/utf-8-j2me-datastream-implementation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
