<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>If Then Else Continue- Dicas de programação</title>
	<atom:link href="http://ifthenelsecontinue.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ifthenelsecontinue.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Thu, 15 May 2008 15:37:41 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>pt</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='ifthenelsecontinue.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/429633064c437882551a111a6b5fa9ca?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>If Then Else Continue- Dicas de programação</title>
		<link>http://ifthenelsecontinue.wordpress.com</link>
	</image>
			<item>
		<title>Apontamentos sobre a linguagem java versão 5.0</title>
		<link>http://ifthenelsecontinue.wordpress.com/2008/05/15/apontamentos-sobre-a-linguagem-java-versao-50/</link>
		<comments>http://ifthenelsecontinue.wordpress.com/2008/05/15/apontamentos-sobre-a-linguagem-java-versao-50/#comments</comments>
		<pubDate>Thu, 15 May 2008 15:10:34 +0000</pubDate>
		<dc:creator>lmen32</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://ifthenelsecontinue.wordpress.com/?p=16</guid>
		<description><![CDATA[Neste documento Apontamentos sobre a Linguagem Java 5.0 encontram-se notas sobre a linguagem Java 5.0 que foram tiradas durante a preparação para o exame SCJP da Sun.
Espero que a sua divulgação possa ajudar alguém a melhor compreender a linguagem.
Naturalmente que todas as correcções e sugestões de melhoramento são bem-vindas.
       [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=16&subd=ifthenelsecontinue&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Neste documento <a href="http://ifthenelsecontinue.files.wordpress.com/2008/05/certificacao.pdf">Apontamentos sobre a Linguagem Java 5.0</a> encontram-se notas sobre a linguagem Java 5.0 que foram tiradas durante a preparação para o exame SCJP da Sun.</p>
<p>Espero que a sua divulgação possa ajudar alguém a melhor compreender a linguagem.</p>
<p>Naturalmente que todas as correcções e sugestões de melhoramento são bem-vindas.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifthenelsecontinue.wordpress.com/16/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifthenelsecontinue.wordpress.com/16/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifthenelsecontinue.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifthenelsecontinue.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifthenelsecontinue.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifthenelsecontinue.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifthenelsecontinue.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifthenelsecontinue.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifthenelsecontinue.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifthenelsecontinue.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifthenelsecontinue.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifthenelsecontinue.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=16&subd=ifthenelsecontinue&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifthenelsecontinue.wordpress.com/2008/05/15/apontamentos-sobre-a-linguagem-java-versao-50/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/79a16a851b2db78ef2fd415a38396d00?s=96&#38;d=identicon" medium="image">
			<media:title type="html">lmen32</media:title>
		</media:content>
	</item>
		<item>
		<title>funções em javascript</title>
		<link>http://ifthenelsecontinue.wordpress.com/2008/01/09/funcoes-em-javascript/</link>
		<comments>http://ifthenelsecontinue.wordpress.com/2008/01/09/funcoes-em-javascript/#comments</comments>
		<pubDate>Wed, 09 Jan 2008 23:46:21 +0000</pubDate>
		<dc:creator>lmen32</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://ifthenelsecontinue.wordpress.com/2008/01/09/funcoes-em-javascript/</guid>
		<description><![CDATA[Cenário 1 
se só existir esta função,
function a()   {       alert("a()");   }
ela pode ser chamada com qualquer número de parâmetros que o resultado é sempre:
  a();
  a('iuy', 455, 54, 54);
uma caixa de dialogo com a string a(), Não dando qualquer erro de invocação.
Cenário 2

Agora [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=11&subd=ifthenelsecontinue&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong><span style="text-decoration:underline;">Cenário 1 </span></strong></p>
<p>se só existir esta função,</p>
<pre>function a()   {       alert("a()");   }</pre>
<p>ela pode ser chamada com qualquer número de parâmetros que o resultado é sempre:</p>
<pre>  a();
  a('iuy', 455, 54, 54);</pre>
<p>uma caixa de dialogo com a string a(), <strong>Não dando qualquer erro de invocação.</strong></p>
<p><strong><span style="text-decoration:underline;">Cenário 2<br />
</span></strong></p>
<p>Agora se tivermos, só a seguinte função,</p>
<pre>function a(id)   {       alert("a(" + id + ")");   }</pre>
<p>Quando for chamado o código,<br />
a();<br />
a(&#8216;iuy&#8217;, 455, 54, 54);</p>
<p>mostra as seguintes caixas de dialogo:</p>
<ul>
<li> a(undefined)</li>
<li> a(iuy)</li>
</ul>
<p><strong>Não dando qualquer erro de invocação.</strong><br />
<strong><span style="text-decoration:underline;">Cenário 3</span></strong></p>
<p>Duas funções com o mesmo nome, mas com parâmetros diferentes</p>
<pre>function a(id)
  {
      alert("a(" + id + ")");
  }
  function a()
  {
      alert("a()");
  }</pre>
<p>Só a última é que fica disponível para invocação.</p>
<p><strong><span style="text-decoration:underline;">Conclusão: </span></strong><span style="text-decoration:underline;">qualquer função pode ser chamada com qualquer número de parâmetros que não será lançado nenhum erro. Os parâmetros da função não preenchidos no momento da invocação terão o valor &#8220;undefined&#8221;.</span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifthenelsecontinue.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifthenelsecontinue.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifthenelsecontinue.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifthenelsecontinue.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifthenelsecontinue.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifthenelsecontinue.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifthenelsecontinue.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifthenelsecontinue.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifthenelsecontinue.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifthenelsecontinue.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifthenelsecontinue.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifthenelsecontinue.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=11&subd=ifthenelsecontinue&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifthenelsecontinue.wordpress.com/2008/01/09/funcoes-em-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/79a16a851b2db78ef2fd415a38396d00?s=96&#38;d=identicon" medium="image">
			<media:title type="html">lmen32</media:title>
		</media:content>
	</item>
		<item>
		<title>JavaScript</title>
		<link>http://ifthenelsecontinue.wordpress.com/2008/01/09/javascript/</link>
		<comments>http://ifthenelsecontinue.wordpress.com/2008/01/09/javascript/#comments</comments>
		<pubDate>Wed, 09 Jan 2008 23:33:58 +0000</pubDate>
		<dc:creator>lmen32</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://ifthenelsecontinue.wordpress.com/2008/01/09/javascript/</guid>
		<description><![CDATA[Como criar uma classe em javascript:
Definir a classe InputText
/* definição dos tipos */
function InputText(id)  // constructor da classe
{
this.id = id;   // campos da classe
this.text = &#8216;jkjh&#8217;; // campos da classe
}
// definição das operações através da propriedade prototype de cada classe
InputText.prototype.setTextInInput = function () {
var i = document.getElementById(this.id);  // o this indica [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=10&subd=ifthenelsecontinue&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Como criar uma classe em javascript:</p>
<p>Definir a classe InputText</p>
<p>/* definição dos tipos */<br />
function InputText(id)  <strong>// constructor da classe</strong><br />
{<br />
<strong>this.id = id;   // campos da classe<br />
this.text = &#8216;jkjh&#8217;; // campos da classe</strong><br />
}<br />
// definição das operações através da propriedade prototype de cada classe</p>
<p><strong>InputText.prototype</strong>.setTextInInput = function () {<br />
var i = document.getElementById(<strong>this.</strong>id);  // o this indica a instância do objecto que está a invocar a operação</p>
<p>if (i)<br />
{<br />
i.value = this.text;<br />
}<br />
}</p>
<p>InputText.prototype.getTextInInput = function () {<br />
var i = document.getElementById(this.id);<br />
if (i)<br />
{<br />
return i.value;<br />
}<br />
}</p>
<p>InputText.prototype.getText = function () {<br />
this.text = this.getTextInInput();<br />
return this.text;<br />
}</p>
<p>InputText.prototype.setText = function (text) {</p>
<p>this.text = text;<br />
alert(&#8216;a:&#8217; + text);<br />
this.setTextInInput();<br />
}</p>
<p>InputText.prototype.clear = function () {<br />
this.text = &#8221;;<br />
this.setTextInInput();<br />
}</p>
<p><strong>Como usar: </strong></p>
<p>var itext = new InputText(&#8216;itext&#8217;);</p>
<p>itext.setText(&#8216;SLB&#8217;);</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifthenelsecontinue.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifthenelsecontinue.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifthenelsecontinue.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifthenelsecontinue.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifthenelsecontinue.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifthenelsecontinue.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifthenelsecontinue.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifthenelsecontinue.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifthenelsecontinue.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifthenelsecontinue.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifthenelsecontinue.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifthenelsecontinue.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=10&subd=ifthenelsecontinue&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifthenelsecontinue.wordpress.com/2008/01/09/javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/79a16a851b2db78ef2fd415a38396d00?s=96&#38;d=identicon" medium="image">
			<media:title type="html">lmen32</media:title>
		</media:content>
	</item>
		<item>
		<title>IE 6 tag script para incluir ficheiros javascript</title>
		<link>http://ifthenelsecontinue.wordpress.com/2008/01/07/ie-6-tag-script-para-incluir-ficheiros-javascript/</link>
		<comments>http://ifthenelsecontinue.wordpress.com/2008/01/07/ie-6-tag-script-para-incluir-ficheiros-javascript/#comments</comments>
		<pubDate>Mon, 07 Jan 2008 22:38:25 +0000</pubDate>
		<dc:creator>lmen32</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://ifthenelsecontinue.wordpress.com/2008/01/07/ie-6-tag-script-para-incluir-ficheiros-javascript/</guid>
		<description><![CDATA[O IE6 e se calhar o IE7 pode ter um comportamento estranho quando é feita a inclusão de um ficheiro javascript numa página HTML. Tem tudo a haver com a forma com a tag &#60;script&#62; é fechada. Ela tem de ser sempre fechada com a tag &#60;/script&#62;. ex:
Correcto:  &#60;script type=&#8221;text/javascript&#8221; src=&#8221;prototype.js&#8221; &#62;&#60;/script&#62;
Incorrecto mesmo estando [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=9&subd=ifthenelsecontinue&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>O IE6 e se calhar o IE7 pode ter um comportamento estranho quando é feita a inclusão de um ficheiro javascript numa página HTML. Tem tudo a haver com a forma com a tag &lt;script&gt; é fechada. Ela tem de ser sempre fechada com a tag &lt;/script&gt;. ex:</p>
<p>Correcto:  &lt;script type=&#8221;text/javascript&#8221; src=&#8221;prototype.js&#8221; &gt;&lt;/script&gt;</p>
<p>Incorrecto mesmo estando certo do ponto de vista de xml, dá erros estranhos do tipo overflow na linha xxx : &lt;script type=&#8221;text/javascript&#8221; src=&#8221;prototype.js&#8221; /&gt;</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifthenelsecontinue.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifthenelsecontinue.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifthenelsecontinue.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifthenelsecontinue.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifthenelsecontinue.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifthenelsecontinue.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifthenelsecontinue.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifthenelsecontinue.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifthenelsecontinue.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifthenelsecontinue.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifthenelsecontinue.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifthenelsecontinue.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=9&subd=ifthenelsecontinue&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifthenelsecontinue.wordpress.com/2008/01/07/ie-6-tag-script-para-incluir-ficheiros-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/79a16a851b2db78ef2fd415a38396d00?s=96&#38;d=identicon" medium="image">
			<media:title type="html">lmen32</media:title>
		</media:content>
	</item>
		<item>
		<title>Unicode</title>
		<link>http://ifthenelsecontinue.wordpress.com/2007/12/23/unicode/</link>
		<comments>http://ifthenelsecontinue.wordpress.com/2007/12/23/unicode/#comments</comments>
		<pubDate>Sun, 23 Dec 2007 22:55:25 +0000</pubDate>
		<dc:creator>lmen32</dc:creator>
				<category><![CDATA[unicode]]></category>

		<guid isPermaLink="false">http://ifthenelsecontinue.wordpress.com/2007/12/23/unicode/</guid>
		<description><![CDATA[Unicode
Antes do aparecimento do Unicode a forma como os caracteres e símbolos das linguagens humanas eram codificados no computador não era realizada da mesma maneira. As linguagens latinas seguiam a regra de um byte por cada carácter cujo valor é atribuído por uma tabela de caracteres pré-definida como a ASCII ou a ISO-8859-1. Nas linguagens [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=8&subd=ifthenelsecontinue&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p align="center"><strong>Unicode</strong></p>
<p>Antes do aparecimento do Unicode a forma como os caracteres e símbolos das linguagens humanas eram codificados no computador não era realizada da mesma maneira. As linguagens latinas seguiam a regra de um byte por cada carácter cujo valor é atribuído por uma tabela de caracteres pré-definida como a ASCII ou a ISO-8859-1. Nas linguagens orientais devido ao elevado número de caracteres cada é codificado por  múltiplos bytes de acordo com um standard. Para além da quantidade de bytes outra diferença impostas pelas linguagens é a sua orientação de escrita: os ocidentais seguem na sua maioria a orientação da esquerda para a direita enquanto outras linguagens impõe a orientação inversas ou mesmo a orientação de cima para baixo.</p>
<p>Estas diferenças dificultam o processamento informático de textos que têm de combinar diversas linguagens . Para solucionar este problema foi desenvolvido o <strong>Unicode</strong> por forma a definir uma tabela contendo os caracteres de todas as linguagens e algoritmos que permitem misturar pedaços de textos escritos em linguagens diferentes para definir um todo que seja tratável por um computador.</p>
<h2>Tabela de caracteres</h2>
<p>A tabela de caracteres do Unicode representa caracteres e não as suas representações gráficas (claro que na tabela de caracteres há uma representação gráfica do mesmo de forma a ser mais fácil a sua identificação). A representação gráfica de cada carácter Unicode é da responsabilidade do designer de fontes para computador. Além dos caracteres presentes nos alfabetos das linguagens mundiais como as latinas, as árabes, a cirilica, a grega, a chinesa, a japonesa, a coreana entre outras há outros caracteres provenientes de notações como a matemática, a música, musica bizantina, Braille, etc,.</p>
<p>Cada carácter no Unicode tem o nome de <strong>code element</strong> e é identificado por um valor numérico a que se dá o nome de <strong>codepoint</strong>. Também é caracterizado por um nome unívoco, uma abreviação e por várias propriedades, entre elas as mais importantes são:</p>
<ul>
<li>Categoria, isto é, se é 	número ou uma letra, ou um simbolo,</li>
<li>O seu valor numérico se tal 	for aplicável,</li>
<li>Indicação se é 	uma letra maiúscula, minúscula ou se só é 	maiúscula no inicio de uma palavra</li>
<li>Tipo, isto é, se é 	um carácter base, um carácter de combinação, 	 um carácter de formato &#8211; (por exemplo, indicação 	de mudança de linha )  ou um carácter de controle (por 	exemplo, permitem controlar a orientação do texto).</li>
</ul>
<p>Dada a quantidade de informação associada a cada carácter ser muito grande o consorcium Unicode distribui essa informação em vários ficheiros de texto a que se dá o nome de <strong>Unicode Character Database</strong> (UCD).</p>
<p>Desde a versão 3 do Unicode, a mais recente é a 5, que cada carácter da tabela Unicode é representado por um conjunto de <strong>32bits. </strong>A actual versão define 99089 caracteres pertencentes a alfabetos mundiais e a diversas notações. O intervalo de valores disponíveis para os codepoints é chamado de <strong>codespace</strong>, estando definido da seguinte forma:  [0, D7FF]  e [E000, 10FFFFF], existindo por isso 1 114 112 codepoints possíveis de serem atribuídos a code elements.</p>
<p>Numa tentativa de organizar os mais de 99 mil caracteres a especificação Unicode agrupa os caracteres de acordo com a linguagem ou notação a que pertencem, dividindo assim logicamente as secções do codespace. A cada divisão chama-se um <strong>Script</strong>.</p>
<p>Os actuais scripts do Unicode são (primeiro é apresentado o intervalo de codepoints e depois o nome do script):</p>
<p><strong>0000..007F; Basic Latin<br />
0080..00FF; Latin-1 Supplement<br />
0100..017F; Latin Extended-A<br />
0180..024F; Latin Extended-B<br />
0250..02AF; IPA Extensions<br />
02B0..02FF; Spacing Modifier Letters<br />
0300..036F; Combining Diacritical Marks</strong><br />
0370..03FF; Greek and Coptic<br />
0400..04FF; Cyrillic<br />
0500..052F; Cyrillic Supplement<br />
0530..058F; Armenian<br />
0590..05FF; Hebrew<br />
0600..06FF; Arabic<br />
0700..074F; Syriac<br />
0750..077F; Arabic Supplement<br />
0780..07BF; Thaana<br />
07C0..07FF; NKo<br />
0900..097F; Devanagari<br />
0980..09FF; Bengali<br />
0A00..0A7F; Gurmukhi<br />
0A80..0AFF; Gujarati<br />
0B00..0B7F; Oriya<br />
0B80..0BFF; Tamil<br />
0C00..0C7F; Telugu<br />
0C80..0CFF; Kannada<br />
0D00..0D7F; Malayalam<br />
0D80..0DFF; Sinhala<br />
0E00..0E7F; Thai<br />
0E80..0EFF; Lao<br />
0F00..0FFF; Tibetan<br />
1000..109F; Myanmar<br />
10A0..10FF; Georgian<br />
1100..11FF; Hangul Jamo<br />
1200..137F; Ethiopic<br />
1380..139F; Ethiopic Supplement<br />
13A0..13FF; Cherokee<br />
1400..167F; Unified Canadian Aboriginal Syllabics<br />
1680..169F; Ogham<br />
16A0..16FF; Runic<br />
1700..171F; Tagalog<br />
1720..173F; Hanunoo<br />
1740..175F; Buhid<br />
1760..177F; Tagbanwa<br />
1780..17FF; Khmer<br />
1800..18AF; Mongolian<br />
1900..194F; Limbu<br />
1950..197F; Tai Le<br />
1980..19DF; New Tai Lue<br />
19E0..19FF; Khmer Symbols<br />
1A00..1A1F; Buginese<br />
1B00..1B7F; Balinese<br />
1D00..1D7F; Phonetic Extensions<br />
1D80..1DBF; Phonetic Extensions Supplement<br />
1DC0..1DFF; Combining Diacritical Marks Supplement<br />
1E00..1EFF; Latin Extended Additional<br />
1F00..1FFF; Greek Extended<br />
2000..206F; General Punctuation<br />
2070..209F; Superscripts and Subscripts<br />
<strong>20A0..20CF; Currency Symbols</strong><br />
20D0..20FF; Combining Diacritical Marks for Symbols<br />
2100..214F; Letterlike Symbols<br />
2150..218F; Number Forms<br />
2190..21FF; Arrows<br />
2200..22FF; Mathematical Operators<br />
2300..23FF; Miscellaneous Technical<br />
2400..243F; Control Pictures<br />
2440..245F; Optical Character Recognition<br />
2460..24FF; Enclosed Alphanumerics<br />
2500..257F; Box Drawing<br />
2580..259F; Block Elements<br />
25A0..25FF; Geometric Shapes<br />
2600..26FF; Miscellaneous Symbols<br />
2700..27BF; Dingbats<br />
27C0..27EF; Miscellaneous Mathematical Symbols-A<br />
27F0..27FF; Supplemental Arrows-A<br />
2800..28FF; Braille Patterns<br />
2900..297F; Supplemental Arrows-B<br />
2980..29FF; Miscellaneous Mathematical Symbols-B<br />
2A00..2AFF; Supplemental Mathematical Operators<br />
2B00..2BFF; Miscellaneous Symbols and Arrows<br />
2C00..2C5F; Glagolitic<br />
2C60..2C7F; Latin Extended-C<br />
2C80..2CFF; Coptic<br />
2D00..2D2F; Georgian Supplement<br />
2D30..2D7F; Tifinagh<br />
2D80..2DDF; Ethiopic Extended<br />
2E00..2E7F; Supplemental Punctuation<br />
2E80..2EFF; CJK Radicals Supplement<br />
2F00..2FDF; Kangxi Radicals<br />
2FF0..2FFF; Ideographic Description Characters<br />
3000..303F; CJK Symbols and Punctuation<br />
3040..309F; Hiragana<br />
30A0..30FF; Katakana<br />
3100..312F; Bopomofo<br />
3130..318F; Hangul Compatibility Jamo<br />
3190..319F; Kanbun<br />
31A0..31BF; Bopomofo Extended<br />
31C0..31EF; CJK Strokes<br />
31F0..31FF; Katakana Phonetic Extensions<br />
3200..32FF; Enclosed CJK Letters and Months<br />
3300..33FF; CJK Compatibility<br />
3400..4DBF; CJK Unified Ideographs Extension A<br />
4DC0..4DFF; Yijing Hexagram Symbols<br />
4E00..9FFF; CJK Unified Ideographs<br />
A000..A48F; Yi Syllables<br />
A490..A4CF; Yi Radicals<br />
A700..A71F; Modifier Tone Letters<br />
A720..A7FF; Latin Extended-D<br />
A800..A82F; Syloti Nagri<br />
A840..A87F; Phags-pa<br />
AC00..D7AF; Hangul Syllables<br />
D800..DB7F; High Surrogates<br />
DB80..DBFF; High Private Use Surrogates<br />
DC00..DFFF; Low Surrogates<br />
E000..F8FF; Private Use Area<br />
F900..FAFF; CJK Compatibility Ideographs<br />
FB00..FB4F; Alphabetic Presentation Forms<br />
FB50..FDFF; Arabic Presentation Forms-A<br />
FE00..FE0F; Variation Selectors<br />
FE10..FE1F; Vertical Forms<br />
FE20..FE2F; Combining Half Marks<br />
FE30..FE4F; CJK Compatibility Forms<br />
FE50..FE6F; Small Form Variants<br />
FE70..FEFF; Arabic Presentation Forms-B<br />
FF00..FFEF; Halfwidth and Fullwidth Forms<br />
FFF0..FFFF; Specials<br />
10000..1007F; Linear B Syllabary<br />
10080..100FF; Linear B Ideograms<br />
10100..1013F; Aegean Numbers<br />
10140..1018F; Ancient Greek Numbers<br />
10300..1032F; Old Italic<br />
10330..1034F; Gothic<br />
10380..1039F; Ugaritic<br />
103A0..103DF; Old Persian<br />
10400..1044F; Deseret<br />
10450..1047F; Shavian<br />
10480..104AF; Osmanya<br />
10800..1083F; Cypriot Syllabary<br />
10900..1091F; Phoenician<br />
10A00..10A5F; Kharoshthi<br />
12000..123FF; Cuneiform<br />
12400..1247F; Cuneiform Numbers and Punctuation<br />
1D000..1D0FF; Byzantine Musical Symbols<br />
1D100..1D1FF; Musical Symbols<br />
1D200..1D24F; Ancient Greek Musical Notation<br />
1D300..1D35F; Tai Xuan Jing Symbols<br />
1D360..1D37F; Counting Rod Numerals<br />
1D400..1D7FF; Mathematical Alphanumeric Symbols<br />
20000..2A6DF; CJK Unified Ideographs Extension B<br />
2F800..2FA1F; CJK Compatibility Ideographs Supplement<br />
E0000..E007F; Tags<br />
E0100..E01EF; Variation Selectors Supplement<br />
F0000..FFFFF; Supplementary Private Use Area-A<br />
100000..10FFFF; Supplementary Private Use Area-B</p>
<p>Os caracteres cujo code point pode ser codificados por 16 bits (entre 0 e 65536) estão no plano  <strong>Basic Multilingual Plane</strong> (BMP), correspondendo aos scripts da maioria das linguagens humanas.</p>
<p>O Unicode foi desenhado para ser compatível com algumas codificações já existentes como o código ASCII ou o ISO-8859-1, pelo que os primeiros 255 caracteres são idênticos a esses dois códigos, por exemplo a letra A tem o valor 65(dec) no Unicode, no ASCII e no ISO-8859-1.</p>
<p>Para além dos caracteres das linguagens humanas também estão definidos caracteres que permitem ao computador identificar onde começa uma palavra, uma linha ou um paragrafo, são os chamados caracteres de controlo. A seguir identifica-se alguns dos caracteres de controlo mais importantes:</p>
<p>Caracteres para mudança de linha e de paragrafo:</p>
<table border="1" cellspacing="0" cellpadding="4" width="404">
<tbody>
<tr valign="top">
<td width="119">
<p align="left"><strong>Acronym 			Name</strong></p>
</td>
<td width="120">
<p align="left"><strong>Unicode </strong></p>
</td>
<td width="138">
<p align="left"><strong>ASCII </strong></p>
</td>
</tr>
</tbody>
</table>
<p>O Unicode define dois caracteres para delimitar linhas e parágrafos. O seu uso não é obrigatório uma vez que também estão definidos os caracteres usados pelo código ASCII para separar linhas. Note-se que no mundo Windows a mudança de linha é identificada pelo par CRLF ao passo que no UNIX a mudança de linha é indicada apenas por LF.</p>
<p>Caracteres identificadores de espaço</p>
<table border="1" cellspacing="0" cellpadding="4" width="100%">
<tbody>
<tr valign="top">
<td width="24%"><strong>Code </strong></td>
<td width="76%"><strong>Name</strong></td>
</tr>
</tbody>
</table>
<p>Caracteres que permitem controlar a direcção do texto, isto é, se ele flui da esquerda para a direita ou vice-versa. São usados quando há uma combinação de texto bi-direccional, senão o seu uso não é obrigatório.</p>
<table border="1" cellspacing="0" cellpadding="4" width="100%">
<tbody>
<tr valign="top">
<td width="27%"><strong>Code </strong></td>
<td width="36%"><strong>Name </strong></td>
<td width="38%"><strong>Abbreviation</strong></td>
</tr>
</tbody>
</table>
<p>O carácter do euro € tem o codepoint U+20AC</p>
<p>Composição de caracteres</p>
<p>Uma diferença do Unicode para os códigos ASCII e ISO-8859-1 é que permite a composição dinâmica de caracteres, isto é, um conjunto de caracteres Unicode combinados entre si podem definir um novo carácter que não está presente na tabela de caracteres. Esta funcionalidade é útil para suportar as linguagens asiáticas. Contudo, do ponto de vista de programação a composição de caracteres elimina a regra &#8220;um carácter por cada unidade de codificação&#8221; que é valida desde os tempos do ASCII.  Para programas pensados para serem executados apenas no Ocidente a regra continua a ser válida uma vez que não é necessário a composição de caracteres para estas linguagens.</p>
<p>Para combinar caracteres é necessário ter um carácter &#8220;base&#8221; e um ou mais caracteres &#8220;combinantes&#8221;. Os caracteres combinantes são aplicados sempre ao carácter base que se apresente à sua esquerda, por exemplo: A sequência de codepoints &lt;U0041 U0307&gt; resulta no caractere  Ä, uma vez que o U0041 é o caracteres base <strong>A</strong> e U0307 é caracter combinante <strong>¨</strong>.</p>
<p>Do exemplo anterior e de uma inspecção à tabela de códigos do Unicode chega-se à conclusão que já existe o carácter Ä com o codepoint 00C4. Tal facto, deve-se como já foi mencionado anteriormente, de o Unicode suportar standards já existentes como o ASCII ou o ISO-8859-1.</p>
<p>Quando um carácter com um codepoint atribuído é igual a um carácter obtidos através de combinação diz-se que ocorreu uma <strong>equivalência</strong>.</p>
<p>Encoding</p>
<p>Como os computadores só entendem conjuntos de bits que podem ter o tamanho de  8, 16, 32 e mais recentemente em 64 o standard Unicode definiu de uma forma clara como representar cada codepoint da tabela de caracteres nos diversos tamanhos. São as chamadas <strong>codificações</strong> (<strong>encodings</strong>). O standard especifica três:</p>
<ul>
<li><strong>UTF-8</strong>: transforma um 	codepoint numa sequência de tamanho variável de bytes 	(conjunto de 8 bits).</li>
<li><strong>UTF-16</strong>: transforma um 	codepoint num ou em dois conjuntos de words (conjunto de 16 bits)</li>
<li><strong>UTF-32</strong>: transforma um 	codepoint num único conjunto de 32 bits.</li>
</ul>
<p>Independente de cada forma de codificação, há a garantia de cada carácter Unicode ser codificado por uma sequência com no máximo 4 conjuntos (bytes).</p>
<p>A sigla <strong>UTF</strong> significa <strong>Unicode Transformation Format</strong>.</p>
<p>A seguinte tabela ilustra os valores das três codificações para quatro caracteres dispersos no codespace do Unicode (os valores estão em hexadecimal e o espaço delimita cada conjunto de bits).</p>
<p>.</p>
<table border="1" cellspacing="0" cellpadding="4" width="100%">
<tbody>
<tr valign="top">
<td width="20%">
<p align="center"><strong>Carácter</strong></p>
</td>
<td width="20%">
<p align="center"><strong>A</strong></p>
</td>
<td width="20%">
<p align="center"><strong>Ω</strong></p>
</td>
<td width="20%">
<p align="center"><strong>representação indisponível</strong></p>
</td>
<td width="20%">
<p align="center"><strong>representação indisponível</strong></p>
</td>
</tr>
</tbody>
</table>
<p>Como pode ser observado, em algumas situações os valores de UTF-16 e UTF-8 não são iguais ao valor do codepoint codificado. Tal facto está  relacionado com as regras de cada codificação, que são:</p>
<p>Para a codificação UTF-32:</p>
<ul>
<li>os codepoints são 	codificados directamente em 32 bits sendo bem formado se estiver 	entre os valores do codespace Unicode: [0, D7FF] ou [E000 e 10FFFF]</li>
</ul>
<p>Para a codificação UTF-16:</p>
<ul>
<li>os codepoints entre [0000 e FFFF] 	(hex), com um número menor que 16bits, são 	representados directamente numa única Word.</li>
<li>os codepoints entre 10000(hex) e 	10FFFF(hex) são representados através de duas words 	usando a seguinte regra:
<ul>
<li>O valor binário de um 		codepoint na forma  000uuuuuxxxxxxxxxxxxxxxx é codificado em 		duas words: A primeira constituída por 110110wwwwxxxxxx e a 		segunda por 110111xxxxxxxxxx, onde wwww=uuuuu-1</li>
</ul>
</li>
</ul>
<p>Para o UTF-8 (&lt;NU&gt; = Não usado):</p>
<table border="1" cellspacing="0" cellpadding="4" width="100%">
<tbody>
<tr valign="top">
<td width="39%">Codepoint</td>
<td width="15%">1º byte</td>
<td width="15%">2ºbyte</td>
<td width="15%">3ºbyte</td>
<td width="16%">4ºbyte</td>
</tr>
</tbody>
</table>
<p>As codificações UTF-16 e UTF-32 tem variantes para acomodar o tipo de processador que codificou o texto, ou seja se ele é Big-Endien (onde o byte mais significativo é colocado primeiro) ou Litle-Endien (onde o byte menos significativo é colocado primeiro).  As codificações para estes casos chamam-se UTF-16-LE, UTF-32-LE,  UTF-16-BE, UTF-32-BE e seguem as regras de codificações descritas anteriormente para o UTF-16 e UTF-32. A única diferença é a ordem dos bytes obtidos como resultado da codificação. A codificação UTF-8 não tem variante BE ou LE porque os bits de um byte são processados pela mesma ordem em todas as arquitecturas.</p>
<p>As codificações UTF-16 e UTF-32 levantam um problema de interpretação porque não indicam qual a ordem de leitura dos bytes, ao contrario das codificações UTF-16-BE, UTF-16-LE, UTF-32-BE e UTF-32-LE que especificam claramente a sua ordem. Para resolver este problema, o Unicode definiu o carácter Byte Order Mark (BOM) com o codepoint UFEFF que permite identificar a ordem de leitura dos bytes das codificações UTF-16 e UTF-32.</p>
<p>A inclusão do BOM não é obrigatório, o que nesse caso deixa à consideração da aplicação leitora  a interpretação da ordem de leitura dos bytes, embora haja a tendência de ser interpretada como  big-endien.</p>
<p>O BOM quando usado para identificar a ordem deve surgir antes da informação codificada (deve ser o primeiro carácter) e dependendo da ordem de bytes usada na codificação o seu valor identifica o ardem de codificação, assim, se o seu valor é :</p>
<ul>
<li>U+FEFF 	identifica que a informação está codificada na 	ordem litle-endien</li>
<li>U+FFFE 	indica a ordem big-enfien.</li>
</ul>
<p>As codificações UTF-16BE, UTF-16LE, UTF-32BE e UTF-32LE não necessitam do BOM porque a ordem dos byte é explicitada pelos sufixos BE (Big-endien) e LE (little-endien).</p>
<p>A seguinte tabela demonstra a codificação de um único codepoint nas várias variantes da UTF-16</p>
<p align="left">
<table border="1" cellspacing="0" cellpadding="4" width="328">
<tbody>
<tr valign="top">
<td width="82">
<p align="left">Codepoint</p>
</td>
<td width="92">
<p align="left">Codificação</p>
</td>
<td width="128">
<p align="left">Valor</p>
</td>
</tr>
</tbody>
</table>
<p>Um efeito colateral interessante do uso do BOM é que permite implicitamente identificar que a informação seguinte são caracteres Unicode, embora tal detecção não seja fiável uma vez que o standard não obriga o seu uso. Na codificação UTF-8 o BOM é expresso pela sequência &lt;EF BB BF&gt;, não tendo qualquer significado a não ser que é provável que a informação a seguir seja texto Unicode.</p>
<p>Ordenação e pesquisa de caracteres</p>
<p>O critério de ordenação de caracteres não é uniforme entre as diversas linguagens. Cada uma tem as suas particularidades devido à posição a que atribui aos caracteres do seu alfabeto, como ordena os caracteres com acento ou como ordena os caracteres na forma maiúscula ou na forma minúscula.</p>
<p><strong>Collation</strong> é o termo dado à forma como duas string são comparadas de forma a determinar qual a menor e a maior.</p>
<p>No Unicode não se podem comparar Strings de caracteres através da comparação directa do valor do codepoint de cada carácter.</p>
<p>Para comparar String Unicode deve-se usar o Algoritmo  &#8220;Unicode Colaction Algorithm&#8221; que através de uma Collation Element Table consegue ordena as strings. O standard Unicode define a Default Unicode Collation Element Table, como sendo a tabela a usar com o algoritmo.</p>
<p>A tabela Collation Element Table também é usada na operação de pesquisa de caracteres.</p>
<p>Visualização de texto e a Bidireccionalidade</p>
<p>Quando é necessário misturar texto de linguagens com diferentes orientações tem de haver uma maneira de identificar onde começa e acaba cada orientação. Para tal, na tabela de caracteres Unicode há caracteres de controlo caracterizadores da orientação e que devem ser usados de acordo com o algoritmo &#8220;Bidireccional Algorithm&#8221;.</p>
<p>Os caracteres de controlo só tem influência para a operação de visualização do texto e tem um âmbito de acção somente no paragrafo em que estão presentes. Estes caracteres não têm  importância para outros aspectos do texto.  Cada paragrafo pode ser delimitado por um carácter de controlo que existe no Unicode.</p>
<p>De uma forma simplista o algoritmo da bidirecionalidade obriga a que o texto com uma determinada  orientação começe com o carácter de controlo identificador da orientação, que pode ser o  RLE para  o sentido direita-esquerda ou o LRE o para o sentido esquerda-direita, seguido dos caracteres de texto a ser visualizados terminando com o carácter de controlo de fim de paragrafo ou com o carácter de controlo PDF (Pop Directional Format ) que anula a ultima orientação dada por RLE ou LRE.</p>
<p>Conclusão</p>
<p>O standard Unicode ao contrário do simples código ASCII ou ISO-8859-1 não é só uma simples tabela gigante com todos os caracteres usados pelas linguagens mundiais, também, apresenta  algoritmos que permitem do ponto de vista linguístico processar o texto de acordo com a convenção de cada país e idioma. A título ilustrativo, para além dos já mencionados algoritmos de ordenação, visualização há outros que permitem identificar os limites de um carácter, de uma palavra, de uma frase ou mesmo de um paragrafo.</p>
<p>Referências:</p>
<ul>
<li>Tabela 	de caracteres do Unicode 5.0: 	<a title="Unicode 5.0 Code Charts" name="Unicode 5.0 Code Charts" href="http://www.unicode.org/Public/5.0.0/charts/CodeCharts.pdf" target="_blank">http://www.unicode.org/Public/5.0.0/charts/CodeCharts.pdf</a></li>
<li>Unicode 	Chart Database do Unicode 5.0: 	<a title="Unicode 5.0 Code Charts" href="http://www.unicode.org/Public/5.0.0/ucd/" target="_blank">http://www.unicode.org/Public/5.0.0/ucd/</a></li>
<li>Livro 	Oficial do standard Unicode 5.0: 	<a title="Livro Unicode 5.0" name="Livro Unicode 5.0" href="http://www.unicode.org/versions/Unicode5.0.0/" target="_blank">http://www.unicode.org/versions/Unicode5.0.0/</a></li>
</ul>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifthenelsecontinue.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifthenelsecontinue.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifthenelsecontinue.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifthenelsecontinue.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifthenelsecontinue.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifthenelsecontinue.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifthenelsecontinue.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifthenelsecontinue.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifthenelsecontinue.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifthenelsecontinue.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifthenelsecontinue.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifthenelsecontinue.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=8&subd=ifthenelsecontinue&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifthenelsecontinue.wordpress.com/2007/12/23/unicode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/79a16a851b2db78ef2fd415a38396d00?s=96&#38;d=identicon" medium="image">
			<media:title type="html">lmen32</media:title>
		</media:content>
	</item>
		<item>
		<title>O Símbolo euro e os encodings de JAVA</title>
		<link>http://ifthenelsecontinue.wordpress.com/2007/12/10/o-simbolo-euro-e-os-encodings-de-java/</link>
		<comments>http://ifthenelsecontinue.wordpress.com/2007/12/10/o-simbolo-euro-e-os-encodings-de-java/#comments</comments>
		<pubDate>Mon, 10 Dec 2007 23:59:06 +0000</pubDate>
		<dc:creator>lmen32</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://ifthenelsecontinue.wordpress.com/2007/12/10/o-simbolo-euro-e-os-encodings-de-java/</guid>
		<description><![CDATA[O símbolo do euro € é sobejamente conhecido mas levanta enormes dores de cabeça quando é necessário transferir a sua representação entre aplicações ou dentro da mesma aplicação quando a representação é guardada num conjuntos de bytes, por exemplo, um ficheiro ou array.
A linguagem JAVA considera todos os caracteres de uma string como pertencendo ao [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=7&subd=ifthenelsecontinue&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>O símbolo do euro <strong>€</strong> é sobejamente conhecido mas levanta enormes dores de cabeça quando é necessário transferir a sua representação entre aplicações ou dentro da mesma aplicação quando a representação é guardada num conjuntos de bytes, por exemplo, um ficheiro ou array.</p>
<p>A linguagem JAVA considera todos os caracteres de uma string como pertencendo ao úniverso de codepoints (numa forma simplista um codepoint corresponde a um caracter do código ASCII) da especificação <strong>Unicode</strong>. No <strong>Unicode </strong>o símbolo € está atribuído ao codepoint <strong>20</strong><span><strong>AChex</strong> </span> que ultrapassa em muito os 255 valores da tabela ASCII ou da tabela que actualmente é mais usada no nosso país o ISO-8859-1. Na prática a tabela ISO-8859-1  corresponde aos primeiros 255 simbolos da Unicode, por isso, se o universo de caracteres usados por uma aplicação corresponder apenas aos símbolos do ISO-8859-1 pode-se representar cada caracter de uma String num único byte. Iste estratagema serve para o os caracteres acentuados, por exemplo, mas não para o símbolo do euro, que não faz parte do alfabeto do ISO-8859-1</p>
<p><img src="http://htmlhelp.com/reference/charset/latin1.gif" border="1" alt="Alfabeto do ISO-8859-1" width="1143" height="1530" align="middle" /></p>
<p>Portanto, quando for necessário gravar uma String contento o símbolo do Euro num conjunto de bytes, deve-se codificar os caracteres usando os métodos oficiais do Unicode: <strong>UTF-8</strong>, <strong>UTF-16</strong>, <strong>UTF-32</strong> ou recorrendo a alfabetos que contenham os caracteres normal do alfabeto português e o símbolo do euro. Os alfabetos candidatos são: <strong>ISO-8859-15</strong> onde o símbolo do euro tem o valor de <strong>A4</strong>hex (O ISO-8859-15 é uma actualização do ISO-8859-1 onde uns quantos caracteres menos usados foram substituídos por outros que faziam falta como por exemplo o €) ou o <strong>CP1252</strong> do windows onde o euro ocupa o lugar de <strong>80hex</strong>.</p>
<table class="wikitable" style="text-align:center;border-collapse:collapse;" border="0">
<tbody>
<tr>
<th colspan="17" align="center">Windows-1252 (CP1252)</th>
</tr>
<tr>
<th></th>
<th>x0</th>
<th>x1</th>
<th>x2</th>
<th>x3</th>
<th>x4</th>
<th>x5</th>
<th>x6</th>
<th>x7</th>
<th>x8</th>
<th>x9</th>
<th>xA</th>
<th>xB</th>
<th>xC</th>
<th>xD</th>
<th>xE</th>
<th>xF</th>
</tr>
<tr>
<th>0x</th>
<td style="text-decoration:underline;"><a title="Null character" href="http://en.wikipedia.org/wiki/Null_character">NUL</a><br />
<em><strong>0</strong></em></td>
<td style="text-decoration:underline;">SOH<br />
<em><strong>1</strong></em></td>
<td style="text-decoration:underline;">STX<br />
<em><strong>2</strong></em></td>
<td style="text-decoration:underline;">ETX<br />
<em><strong>3</strong></em></td>
<td style="text-decoration:underline;">EOT<br />
<em><strong>4</strong></em></td>
<td style="text-decoration:underline;">ENQ<br />
<em><strong>5</strong></em></td>
<td style="text-decoration:underline;">ACK<br />
<em><strong>6</strong></em></td>
<td style="text-decoration:underline;"><a title="Bell character" href="http://en.wikipedia.org/wiki/Bell_character">BEL</a><br />
<em><strong>7</strong></em></td>
<td style="text-decoration:underline;"><a title="Backspace" href="http://en.wikipedia.org/wiki/Backspace">BS</a><br />
<em><strong>8</strong></em></td>
<td style="text-decoration:underline;"><a title="Tab" href="http://en.wikipedia.org/wiki/Tab">TAB</a><br />
<em><strong>9</strong></em></td>
<td style="text-decoration:underline;"><a title="Line feed" href="http://en.wikipedia.org/wiki/Line_feed">LF</a><br />
<em><strong>10</strong></em></td>
<td style="text-decoration:underline;">VT<br />
<em><strong>11</strong></em></td>
<td style="text-decoration:underline;"><a title="Form Feed" href="http://en.wikipedia.org/wiki/Form_Feed">FF</a><br />
<em><strong>12</strong></em></td>
<td style="text-decoration:underline;"><a title="Carriage Return" href="http://en.wikipedia.org/wiki/Carriage_Return">CR</a><br />
<em><strong>13</strong></em></td>
<td style="text-decoration:underline;">SO<br />
<em><strong>14</strong></em></td>
<td style="text-decoration:underline;">SI<br />
<em><strong>15</strong></em></td>
</tr>
<tr>
<th>1x</th>
<td style="text-decoration:underline;">DLE<br />
<em><strong>16</strong></em></td>
<td style="text-decoration:underline;">DC1<br />
<em><strong>17</strong></em></td>
<td style="text-decoration:underline;">DC2<br />
<em><strong>18</strong></em></td>
<td style="text-decoration:underline;">DC3<br />
<em><strong>19</strong></em></td>
<td style="text-decoration:underline;">DC4<br />
<em><strong>20</strong></em></td>
<td style="text-decoration:underline;">NAK<br />
<em><strong>21</strong></em></td>
<td style="text-decoration:underline;">SYN<br />
<em><strong>22</strong></em></td>
<td style="text-decoration:underline;">ETB<br />
<em><strong>23</strong></em></td>
<td style="text-decoration:underline;">CAN<br />
<em><strong>24</strong></em></td>
<td style="text-decoration:underline;">EM<br />
<em><strong>25</strong></em></td>
<td style="text-decoration:underline;"><a title="Substitute character" href="http://en.wikipedia.org/wiki/Substitute_character">SUB</a><br />
<em><strong>26</strong></em></td>
<td style="text-decoration:underline;"><a title="Escape character" href="http://en.wikipedia.org/wiki/Escape_character">ESC</a><br />
<em><strong>27</strong></em></td>
<td style="text-decoration:underline;">FS<br />
<em><strong>28</strong></em></td>
<td style="text-decoration:underline;">GS<br />
<em><strong>29</strong></em></td>
<td style="text-decoration:underline;">RS<br />
<em><strong>30</strong></em></td>
<td style="text-decoration:underline;">US<br />
<em><strong>31</strong></em></td>
</tr>
<tr>
<th>2x</th>
<td style="text-decoration:underline;"><a title="Space character" href="http://en.wikipedia.org/wiki/Space_character">SP</a><br />
<em><strong>32</strong></em></td>
<td><a title="Exclamation mark" href="http://en.wikipedia.org/wiki/Exclamation_mark">!</a><br />
<em><strong>33</strong></em></td>
<td><a title="Quotation mark" href="http://en.wikipedia.org/wiki/Quotation_mark">&#8220;</a><br />
<em><strong>34</strong></em></td>
<td><a title="Number sign" href="http://en.wikipedia.org/wiki/Number_sign">#</a><br />
<em><strong>35</strong></em></td>
<td><a title="Dollar sign" href="http://en.wikipedia.org/wiki/Dollar_sign">$</a><br />
<em><strong>36</strong></em></td>
<td><a title="Percent sign" href="http://en.wikipedia.org/wiki/Percent_sign">%</a><br />
<em><strong>37</strong></em></td>
<td><a title="&amp;" href="http://en.wikipedia.org/wiki/%26">&amp;</a><br />
<em><strong>38</strong></em></td>
<td><a title="'" href="http://en.wikipedia.org/wiki/%27">&#8216;</a><br />
<em><strong>39</strong></em></td>
<td><a title="Bracket" href="http://en.wikipedia.org/wiki/Bracket">(</a><br />
<em><strong>40</strong></em></td>
<td><a title="Bracket" href="http://en.wikipedia.org/wiki/Bracket">)</a><br />
<em><strong>41</strong></em></td>
<td><a title="Asterisk" href="http://en.wikipedia.org/wiki/Asterisk">*</a><br />
<em><strong>42</strong></em></td>
<td><a title="Plus and minus signs" href="http://en.wikipedia.org/wiki/Plus_and_minus_signs">+</a><br />
<em><strong>43</strong></em></td>
<td><a title="Comma (punctuation)" href="http://en.wikipedia.org/wiki/Comma_%28punctuation%29">,</a><br />
<em><strong>44</strong></em></td>
<td><a title="Plus and minus signs" href="http://en.wikipedia.org/wiki/Plus_and_minus_signs">-</a><br />
<em><strong>45</strong></em></td>
<td><a title="Full stop" href="http://en.wikipedia.org/wiki/Full_stop">.</a><br />
<em><strong>46</strong></em></td>
<td><a title="Slash (punctuation)" href="http://en.wikipedia.org/wiki/Slash_%28punctuation%29">/</a><br />
<em><strong>47</strong></em></td>
</tr>
<tr>
<th>3x</th>
<td>0<br />
<em><strong>48</strong></em></td>
<td>1<br />
<em><strong>49</strong></em></td>
<td>2<br />
<em><strong>50</strong></em></td>
<td>3<br />
<em><strong>51</strong></em></td>
<td>4<br />
<em><strong>52</strong></em></td>
<td>5<br />
<em><strong>53</strong></em></td>
<td>6<br />
<em><strong>54</strong></em></td>
<td>7<br />
<em><strong>55</strong></em></td>
<td>8<br />
<em><strong>56</strong></em></td>
<td>9<br />
<em><strong>57</strong></em></td>
<td>:<br />
<em><strong>58</strong></em></td>
<td>;<br />
<em><strong>59</strong></em></td>
<td>&lt;<br />
<em><strong>60</strong></em></td>
<td>=<br />
<em><strong>61</strong></em></td>
<td>&gt;<br />
<em><strong>62</strong></em></td>
<td>?<br />
<em><strong>63</strong></em></td>
</tr>
<tr>
<th>4x</th>
<td>@<br />
<em><strong>64</strong></em></td>
<td>A<br />
<em><strong>65</strong></em></td>
<td>B<br />
<em><strong>66</strong></em></td>
<td>C<br />
<em><strong>67</strong></em></td>
<td>D<br />
<em><strong>68</strong></em></td>
<td>E<br />
<em><strong>69</strong></em></td>
<td>F<br />
<em><strong>70</strong></em></td>
<td>G<br />
<em><strong>71</strong></em></td>
<td>H<br />
<em><strong>72</strong></em></td>
<td>I<br />
<em><strong>73</strong></em></td>
<td>J<br />
<em><strong>74</strong></em></td>
<td>K<br />
<em><strong>75</strong></em></td>
<td>L<br />
<em><strong>76</strong></em></td>
<td>M<br />
<em><strong>77</strong></em></td>
<td>N<br />
<em><strong>78</strong></em></td>
<td>O<br />
<em><strong>79</strong></em></td>
</tr>
<tr>
<th>5x</th>
<td>P<br />
<em><strong>80</strong></em></td>
<td>Q<br />
<em><strong>81</strong></em></td>
<td>R<br />
<em><strong>82</strong></em></td>
<td>S<br />
<em><strong>83</strong></em></td>
<td>T<br />
<em><strong>84</strong></em></td>
<td>U<br />
<em><strong>85</strong></em></td>
<td>V<br />
<em><strong>86</strong></em></td>
<td>W<br />
<em><strong>87</strong></em></td>
<td>X<br />
<em><strong>88</strong></em></td>
<td>Y<br />
<em><strong>89</strong></em></td>
<td>Z<br />
<em><strong>90</strong></em></td>
<td>[<br />
<em><strong>91</strong></em></td>
<td>\<br />
<em><strong>92</strong></em></td>
<td>]<br />
<em><strong>93</strong></em></td>
<td><a title="Caret" href="http://en.wikipedia.org/wiki/Caret">^</a><br />
<em><strong>94</strong></em></td>
<td><a title="Underscore" href="http://en.wikipedia.org/wiki/Underscore">_</a><br />
<em><strong>95</strong></em></td>
</tr>
<tr>
<th>6x</th>
<td>`<br />
<em><strong>96</strong></em></td>
<td>a<br />
<em><strong>97</strong></em></td>
<td>b<br />
<em><strong>98</strong></em></td>
<td>c<br />
<em><strong>99</strong></em></td>
<td>d<br />
<em><strong>100</strong></em></td>
<td>e<br />
<em><strong>101</strong></em></td>
<td>f<br />
<em><strong>102</strong></em></td>
<td>g<br />
<em><strong>103</strong></em></td>
<td>h<br />
<em><strong>104</strong></em></td>
<td>i<br />
<em><strong>105</strong></em></td>
<td>j<br />
<em><strong>106</strong></em></td>
<td>k<br />
<em><strong>107</strong></em></td>
<td>l<br />
<em><strong>108</strong></em></td>
<td>m<br />
<em><strong>109</strong></em></td>
<td>n<br />
<em><strong>110</strong></em></td>
<td>o<br />
<em><strong>111</strong></em></td>
</tr>
<tr>
<th>7x</th>
<td>p<br />
<em><strong>112</strong></em></td>
<td>q<br />
<em><strong>113</strong></em></td>
<td>r<br />
<em><strong>114</strong></em></td>
<td>s<br />
<em><strong>115</strong></em></td>
<td>t<br />
<em><strong>116</strong></em></td>
<td>u<br />
<em><strong>117</strong></em></td>
<td>v<br />
<em><strong>118</strong></em></td>
<td>w<br />
<em><strong>119</strong></em></td>
<td>x<br />
<em><strong>120</strong></em></td>
<td>y<br />
<em><strong>121</strong></em></td>
<td>z<br />
<em><strong>122</strong></em></td>
<td>{<br />
<em><strong>123</strong></em></td>
<td><a title="Pipe (computing)" href="http://en.wikipedia.org/wiki/Pipe_%28computing%29">|</a><br />
<em><strong>124</strong></em></td>
<td>}<br />
<em><strong>125</strong></em></td>
<td><a title="Tilde" href="http://en.wikipedia.org/wiki/Tilde">~</a><br />
<em><strong>126</strong></em></td>
<td style="text-decoration:underline;">DEL<br />
<em><strong>127</strong></em></td>
</tr>
<tr>
<th>Ax</th>
<td style="text-decoration:underline;"><a title="Non-breaking space" href="http://en.wikipedia.org/wiki/Non-breaking_space">NBSP</a><br />
<em><strong>160</strong></em></td>
<td><a title="Exclamation mark" href="http://en.wikipedia.org/wiki/Exclamation_mark">¡</a><br />
<em><strong>161</strong></em></td>
<td><a title="Cent (currency)" href="http://en.wikipedia.org/wiki/Cent_%28currency%29">¢</a><br />
<em><strong>162</strong></em></td>
<td><a title="Pound sign" href="http://en.wikipedia.org/wiki/Pound_sign">£</a><br />
<em><strong>163</strong></em></td>
<td><a title="Currency" href="http://en.wikipedia.org/wiki/Currency">¤</a><br />
<em><strong>164</strong></em></td>
<td><a title="Yen" href="http://en.wikipedia.org/wiki/Yen">¥</a><br />
<em><strong>165</strong></em></td>
<td><a title="Pipe (computing)" href="http://en.wikipedia.org/wiki/Pipe_%28computing%29">¦</a><br />
<em><strong>166</strong></em></td>
<td><a title="Section sign" href="http://en.wikipedia.org/wiki/Section_sign">§</a><br />
<em><strong>167</strong></em></td>
<td><a title="Diaeresis" href="http://en.wikipedia.org/wiki/Diaeresis">¨</a><br />
<em><strong>168</strong></em></td>
<td><a title="Copyright symbol" href="http://en.wikipedia.org/wiki/Copyright_symbol">©</a><br />
<em><strong>169</strong></em></td>
<td><a title="ª" href="http://en.wikipedia.org/wiki/%C2%AA">ª</a><br />
<em><strong>170</strong></em></td>
<td><a title="Angle quotes" href="http://en.wikipedia.org/wiki/Angle_quotes">«</a><br />
<em><strong>171</strong></em></td>
<td><a title="Logical not" href="http://en.wikipedia.org/wiki/Logical_not">¬</a><br />
<em><strong>172</strong></em></td>
<td style="text-decoration:underline;"><a title="Soft hyphen" href="http://en.wikipedia.org/wiki/Soft_hyphen">SHY</a><br />
<em><strong>173</strong></em></td>
<td><a title="®" href="http://en.wikipedia.org/wiki/%C2%AE">®</a><br />
<em><strong>174</strong></em></td>
<td><a title="Macron" href="http://en.wikipedia.org/wiki/Macron">¯</a><br />
<em><strong>175</strong></em></td>
</tr>
<tr>
<th>Bx</th>
<td><a title="Degree (symbol)" href="http://en.wikipedia.org/wiki/Degree_%28symbol%29">°</a><br />
<em><strong>176</strong></em></td>
<td><a title="Plus-minus sign" href="http://en.wikipedia.org/wiki/Plus-minus_sign">±</a><br />
<em><strong>177</strong></em></td>
<td><a title="Square (algebra)" href="http://en.wikipedia.org/wiki/Square_%28algebra%29">²</a><br />
<em><strong>178</strong></em></td>
<td><a title="Cube (arithmetic)" href="http://en.wikipedia.org/wiki/Cube_%28arithmetic%29">³</a><br />
<em><strong>179</strong></em></td>
<td><a title="Acute accent" href="http://en.wikipedia.org/wiki/Acute_accent">´</a><br />
<em><strong>180</strong></em></td>
<td><a title="Mu (letter)" href="http://en.wikipedia.org/wiki/Mu_%28letter%29">µ</a><br />
<em><strong>181</strong></em></td>
<td><a title="Pilcrow" href="http://en.wikipedia.org/wiki/Pilcrow">¶</a><br />
<em><strong>182</strong></em></td>
<td><a title="Interpunct" href="http://en.wikipedia.org/wiki/Interpunct">·</a><br />
<em><strong>183</strong></em></td>
<td><a title="Cedilla" href="http://en.wikipedia.org/wiki/Cedilla">¸</a><br />
<em><strong>184</strong></em></td>
<td><a title="¹" href="http://en.wikipedia.org/wiki/%C2%B9">¹</a><br />
<em><strong>185</strong></em></td>
<td><a title="º" href="http://en.wikipedia.org/wiki/%C2%BA">º</a><br />
<em><strong>186</strong></em></td>
<td><a title="Angle quotes" href="http://en.wikipedia.org/wiki/Angle_quotes">»</a><br />
<em><strong>187</strong></em></td>
<td><a title="¼" href="http://en.wikipedia.org/wiki/%C2%BC">¼</a><br />
<em><strong>188</strong></em></td>
<td><a title="½" href="http://en.wikipedia.org/wiki/%C2%BD">½</a><br />
<em><strong>189</strong></em></td>
<td><a title="¾" href="http://en.wikipedia.org/wiki/%C2%BE">¾</a><br />
<em><strong>190</strong></em></td>
<td><a title="Question mark" href="http://en.wikipedia.org/wiki/Question_mark">¿</a><br />
<em><strong>191</strong></em></td>
</tr>
<tr>
<th>Cx</th>
<td><a title="À" href="http://en.wikipedia.org/wiki/%C3%80">À</a><br />
<em><strong>192</strong></em></td>
<td><a title="Á" href="http://en.wikipedia.org/wiki/%C3%81">Á</a><br />
<em><strong>193</strong></em></td>
<td><a title="Â" href="http://en.wikipedia.org/wiki/%C3%82">Â</a><br />
<em><strong>194</strong></em></td>
<td><a title="Ã" href="http://en.wikipedia.org/wiki/%C3%83">Ã</a><br />
<em><strong>195</strong></em></td>
<td><a title="Ä" href="http://en.wikipedia.org/wiki/%C3%84">Ä</a><br />
<em><strong>196</strong></em></td>
<td><a title="Å" href="http://en.wikipedia.org/wiki/%C3%85">Å</a><br />
<em><strong>197</strong></em></td>
<td><a title="Æ" href="http://en.wikipedia.org/wiki/%C3%86">Æ</a><br />
<em><strong>198</strong></em></td>
<td><a title="Cedilla" href="http://en.wikipedia.org/wiki/Cedilla">Ç</a><br />
<em><strong>199</strong></em></td>
<td><a title="È" href="http://en.wikipedia.org/wiki/%C3%88">È</a><br />
<em><strong>200</strong></em></td>
<td><a title="É" href="http://en.wikipedia.org/wiki/%C3%89">É</a><br />
<em><strong>201</strong></em></td>
<td><a title="Ê" href="http://en.wikipedia.org/wiki/%C3%8A">Ê</a><br />
<em><strong>202</strong></em></td>
<td><a title="Ë" href="http://en.wikipedia.org/wiki/%C3%8B">Ë</a><br />
<em><strong>203</strong></em></td>
<td><a title="Ì" href="http://en.wikipedia.org/wiki/%C3%8C">Ì</a><br />
<em><strong>204</strong></em></td>
<td><a title="Í" href="http://en.wikipedia.org/wiki/%C3%8D">Í</a><br />
<em><strong>205</strong></em></td>
<td><a title="Î" href="http://en.wikipedia.org/wiki/%C3%8E">Î</a><br />
<em><strong>206</strong></em></td>
<td><a title="Ï" href="http://en.wikipedia.org/wiki/%C3%8F">Ï</a><br />
<em><strong>207</strong></em></td>
</tr>
<tr>
<th>Dx</th>
<td><a title="Eth" href="http://en.wikipedia.org/wiki/Eth">Ð</a><br />
<em><strong>208</strong></em></td>
<td><a title="Ñ" href="http://en.wikipedia.org/wiki/%C3%91">Ñ</a><br />
<em><strong>209</strong></em></td>
<td><a title="Ò" href="http://en.wikipedia.org/wiki/%C3%92">Ò</a><br />
<em><strong>210</strong></em></td>
<td><a title="Ó" href="http://en.wikipedia.org/wiki/%C3%93">Ó</a><br />
<em><strong>211</strong></em></td>
<td><a title="Ô" href="http://en.wikipedia.org/wiki/%C3%94">Ô</a><br />
<em><strong>212</strong></em></td>
<td><a title="Õ" href="http://en.wikipedia.org/wiki/%C3%95">Õ</a><br />
<em><strong>213</strong></em></td>
<td><a title="Ö" href="http://en.wikipedia.org/wiki/%C3%96">Ö</a><br />
<em><strong>214</strong></em></td>
<td><a title="×" href="http://en.wikipedia.org/wiki/%C3%97">×</a><br />
<em><strong>215</strong></em></td>
<td><a title="Ø" href="http://en.wikipedia.org/wiki/%C3%98">Ø</a><br />
<em><strong>216</strong></em></td>
<td><a title="Ù" href="http://en.wikipedia.org/wiki/%C3%99">Ù</a><br />
<em><strong>217</strong></em></td>
<td><a title="Ú" href="http://en.wikipedia.org/wiki/%C3%9A">Ú</a><br />
<em><strong>218</strong></em></td>
<td><a title="Û" href="http://en.wikipedia.org/wiki/%C3%9B">Û</a><br />
<em><strong>219</strong></em></td>
<td><a title="Ü" href="http://en.wikipedia.org/wiki/%C3%9C">Ü</a><br />
<em><strong>220</strong></em></td>
<td><a title="Ý" href="http://en.wikipedia.org/wiki/%C3%9D">Ý</a><br />
<em><strong>221</strong></em></td>
<td><a title="Thorn (letter)" href="http://en.wikipedia.org/wiki/Thorn_%28letter%29">Þ</a><br />
<em><strong>222</strong></em></td>
<td><a title="ß" href="http://en.wikipedia.org/wiki/%C3%9F">ß</a><br />
<em><strong>223</strong></em></td>
</tr>
<tr>
<th>Ex</th>
<td><a title="À" href="http://en.wikipedia.org/wiki/%C3%80">à</a><br />
<em><strong>224</strong></em></td>
<td><a title="Á" href="http://en.wikipedia.org/wiki/%C3%81">á</a><br />
<em><strong>225</strong></em></td>
<td><a title="Â" href="http://en.wikipedia.org/wiki/%C3%82">â</a><br />
<em><strong>226</strong></em></td>
<td><a title="Ã" href="http://en.wikipedia.org/wiki/%C3%83">ã</a><br />
<em><strong>227</strong></em></td>
<td><a title="Ä" href="http://en.wikipedia.org/wiki/%C3%84">ä</a><br />
<em><strong>228</strong></em></td>
<td><a title="Å" href="http://en.wikipedia.org/wiki/%C3%85">å</a><br />
<em><strong>229</strong></em></td>
<td><a title="Æ" href="http://en.wikipedia.org/wiki/%C3%86">æ</a><br />
<em><strong>230</strong></em></td>
<td><a title="Ç" href="http://en.wikipedia.org/wiki/%C3%87">ç</a><br />
<em><strong>231</strong></em></td>
<td><a title="È" href="http://en.wikipedia.org/wiki/%C3%88">è</a><br />
<em><strong>232</strong></em></td>
<td><a title="É" href="http://en.wikipedia.org/wiki/%C3%89">é</a><br />
<em><strong>233</strong></em></td>
<td><a title="Ê" href="http://en.wikipedia.org/wiki/%C3%8A">ê</a><br />
<em><strong>234</strong></em></td>
<td><a title="Ë" href="http://en.wikipedia.org/wiki/%C3%8B">ë</a><br />
<em><strong>235</strong></em></td>
<td><a title="Ì" href="http://en.wikipedia.org/wiki/%C3%8C">ì</a><br />
<em><strong>236</strong></em></td>
<td><a title="Í" href="http://en.wikipedia.org/wiki/%C3%8D">í</a><br />
<em><strong>237</strong></em></td>
<td><a title="Î" href="http://en.wikipedia.org/wiki/%C3%8E">î</a><br />
<em><strong>238</strong></em></td>
<td><a title="Ï" href="http://en.wikipedia.org/wiki/%C3%8F">ï</a><br />
<em><strong>239</strong></em></td>
</tr>
<tr>
<th>Fx</th>
<td><a title="Eth" href="http://en.wikipedia.org/wiki/Eth">ð</a><br />
<em><strong>240</strong></em></td>
<td><a title="Ñ" href="http://en.wikipedia.org/wiki/%C3%91">ñ</a><br />
<em><strong>241</strong></em></td>
<td><a title="Ò" href="http://en.wikipedia.org/wiki/%C3%92">ò</a><br />
<em><strong>242</strong></em></td>
<td><a title="Ó" href="http://en.wikipedia.org/wiki/%C3%93">ó</a><br />
<em><strong>243</strong></em></td>
<td><a title="Ô" href="http://en.wikipedia.org/wiki/%C3%94">ô</a><br />
<em><strong>244</strong></em></td>
<td><a title="Õ" href="http://en.wikipedia.org/wiki/%C3%95">õ</a><br />
<em><strong>245</strong></em></td>
<td><a title="Ö" href="http://en.wikipedia.org/wiki/%C3%96">ö</a><br />
<em><strong>246</strong></em></td>
<td><a title="÷" href="http://en.wikipedia.org/wiki/%C3%B7">÷</a><br />
<em><strong>247</strong></em></td>
<td><a title="Ø" href="http://en.wikipedia.org/wiki/%C3%98">ø</a><br />
<em><strong>248</strong></em></td>
<td><a title="Ù" href="http://en.wikipedia.org/wiki/%C3%99">ù</a><br />
<em><strong>249</strong></em></td>
<td><a title="Ú" href="http://en.wikipedia.org/wiki/%C3%9A">ú</a><br />
<em><strong>250</strong></em></td>
<td><a title="Û" href="http://en.wikipedia.org/wiki/%C3%9B">û</a><br />
<em><strong>251</strong></em></td>
<td><a title="Ü" href="http://en.wikipedia.org/wiki/%C3%9C">ü</a><br />
<em><strong>252</strong></em></td>
<td><a title="Ý" href="http://en.wikipedia.org/wiki/%C3%9D">ý</a><br />
<em><strong>253</strong></em></td>
<td><a title="Thorn (letter)" href="http://en.wikipedia.org/wiki/Thorn_%28letter%29">þ</a><br />
<em><strong>254</strong></em></td>
<td><a title="Ÿ" href="http://en.wikipedia.org/wiki/%C5%B8">ÿ</a><br />
<em><strong>255</strong></em></td>
</tr>
</tbody>
</table>
<p>Tabela do CP1252 (<a title="CP1252" href="http://en.wikipedia.org/wiki/Windows-1252" target="_blank">ver original</a>)</p>
<p>Resumindo,  o valor de <strong><em>char c = &#8216;€&#8217;</em></strong> terá o valor de <strong>20</strong><span><strong>AChex </strong>no alfabeto do <strong>Unicode</strong>,  <strong>nenhum </strong>valor em ISO-8859-1 (o java nesta codificação representa-o por um ponto de interrogação ?), <strong>A4</strong>hex no alfabeto <strong>ISO-8859-15</strong> e <strong>80</strong>hex no alfabeto <strong>CP1252</strong> do windows.</span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifthenelsecontinue.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifthenelsecontinue.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifthenelsecontinue.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifthenelsecontinue.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifthenelsecontinue.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifthenelsecontinue.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifthenelsecontinue.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifthenelsecontinue.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifthenelsecontinue.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifthenelsecontinue.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifthenelsecontinue.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifthenelsecontinue.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=7&subd=ifthenelsecontinue&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifthenelsecontinue.wordpress.com/2007/12/10/o-simbolo-euro-e-os-encodings-de-java/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/79a16a851b2db78ef2fd415a38396d00?s=96&#38;d=identicon" medium="image">
			<media:title type="html">lmen32</media:title>
		</media:content>

		<media:content url="http://htmlhelp.com/reference/charset/latin1.gif" medium="image">
			<media:title type="html">Alfabeto do ISO-8859-1</media:title>
		</media:content>
	</item>
		<item>
		<title>Introdução ao Java Mobile Edition</title>
		<link>http://ifthenelsecontinue.wordpress.com/2007/12/02/introducao-ao-java-mobile-edition/</link>
		<comments>http://ifthenelsecontinue.wordpress.com/2007/12/02/introducao-ao-java-mobile-edition/#comments</comments>
		<pubDate>Sun, 02 Dec 2007 19:50:08 +0000</pubDate>
		<dc:creator>lmen32</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://ifthenelsecontinue.wordpress.com/2007/12/02/introducao-ao-java-mobile-edition/</guid>
		<description><![CDATA[No site oficial da Sun para a plataforma Java encontra-se um artigo que detalha o que é a versão da plataforma Java para os dispositivos que não são PCs mas que tenham um processador mais simples e uma quantidade de memória mais pequena , por exemplo, telemóveis, receptores de TV cabo, frigoríficos, etc,.
O slogan de [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=6&subd=ifthenelsecontinue&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>No site oficial da Sun para a plataforma Java encontra-se <a title="A survey of Java ME Today" href="http://developers.sun.com/mobility/getstart/articles/survey/" target="_blank">um artigo</a> que detalha o que é a versão da plataforma Java para os dispositivos que não são PCs mas que tenham um processador mais simples e uma quantidade de memória mais pequena , por exemplo, telemóveis, receptores de TV cabo, frigoríficos, etc,.</p>
<p>O slogan de lançamento da linguagem Java era &#8220;Write once, run everywhere&#8221;, ou seja, um programa em Java poderia correr em qualquer hardware porque existiria uma implementação da maquina virtual para a executar. Acontece que dentro do mundo dos Pcs esta premissa é relativamente fácil de obter, mesmo com a diferença de  tipos de processador e sistema operativo, porque o que caracteriza um PC/workstation/Servidor é a existência de uma placa gráfica, monitor, teclado query, rato, memória, BIOS, disco rígido e processador de pelo menos 32 bits. A distribuição Java Standard Edition, está pensada para executar neste ambiente de hardware.</p>
<p>Fora do mundo dos PCs o que está à volta do processador e da memória é definido pelo  fabricante do dispositivo, assim como as características do processador e a quantidade de memória: Um modelo de telefone pode ter uma certa quantidade de memória não encontrada noutro modelo, por exemplo e um electrodoméstico &#8220;Java&#8221; pode não ter um teclado query, mas apenas algumas teclas de controlo.</p>
<p>Estando identificado as dificuldades de caracterizar o hardware dos dispositivos a suportar como é que a SUN as solucionou? Ela categorizou o harware existente nos dispositivos e definiu para cada categoria quais as funcionalidades que a máquina virtual Java teria de suportar e quais as packages standards da linguagem Java a disponibilizar. As categorias básicas são:</p>
<p><strong>Connected Limited Device Configuration (CLDC):</strong> pensado para dispositivos com processadores de 16 e 32 bits, com uma ROM minima de 160 KB  e com uma RAM mínima de 32KB. A máquina virtual Java tem restrições relativamente à edição standard  implementando a especificação 1.4 da linguagem, sem ter entre outras coisas, finalizadores de classes e grupos de threads. Quanto às packages disponíveis elas são versões simplificadas de :</p>
<ul>
<li> java.lang</li>
<li>java.lang.ref</li>
<li>java.util</li>
<li>java.io</li>
</ul>
<p>e a inclusão da package javax.microedition.io especializada nas particularidades de input/o utput dos dispositivos.<br />
<strong>Connected Device Configuration (CDC): </strong>pensado para dispositivos mais potentes que os CLDCs, com processadores de 32bits, tendo pelo menos 2.5Mb de ROM e 2Mb de RAM. Acresce às funcionalidade do CLDC a inclusão de versões simplificadas de outras packages standards como:</p>
<ul>
<li>java.lang.reflect</li>
<li>java.math</li>
<li>java.text</li>
<li>java.util.zip</li>
<li>java.util.jar</li>
<li>java.net</li>
</ul>
<p>As configurações CLDC, CDC só definem o ambiente mínimo de execução num dispositivo. Com base nas suas características (existência de ecrân gráfico, de tem teclado, etc) estão definidas especificações que acrescentam packages não existentes na versão desktop da plataforma Java mas que estão adaptadas ao ambiente de execução dos dispositivos. A essas  especificações dão-se o nome de profiles e estão distribuidos pelas configurações do seguinte modo:</p>
<p>A configuração CLDC tem os profiles:</p>
<ul>
<li>Mobile Information Device Profile (<strong>MIDP</strong>), version 1.0 e 2.0</li>
<li>Information Module Profile (<strong>IMO</strong>) versão 1.0 e 2.0</li>
<li>Digital Set Top Box profile</li>
</ul>
<p>A configuração CDC tem os profiles:</p>
<ul>
<li>Foundation Profile</li>
<li>Personal Basis Profile</li>
<li>Personal Profile</li>
</ul>
<p>De todos estes profiles e configurações o mais comum é o CLDC/MIDP que é disponibilizado pela maior parte dos fabricantes de telemóveis.</p>
<p>O profile MIDP especifica as seguintes packages:</p>
<ul>
<li>javax.microedition.lcdui</li>
<li>javax.microedition.lcdui.game</li>
<li>javax.microedition.media</li>
<li>javax.microedition.media.control</li>
<li>javax.microedition.midlet</li>
<li>javax.microedition.pki</li>
<li>javax.microedition.rms (gravar e ler dados persistentes)</li>
</ul>
<p>Informação dos outros profiles e configurações encontra-se no artigo acima mencionado.</p>
<p>A questão é como programar uma aplicação para Mobile Edition. A primeira coisa é verificar quais as configurações e profiles suportadas pelo dispositivo. Esta verificação é estranha para o programador da Standard edition que só se tem de preocupar qual a versão da máquina virtual a suportar.</p>
<p>O ciclo de programação é um pouco mais complicado que o ambiente Desktop porque a fase de codificação e compilação é realizada num PC enquanto que a fase de teste/execução do programa é realizada no dispositivo após a sua transferência. Para acelerar a fase de testes/codificação é normalmente disponibilizado em conjunto com o compilador um emulador do dispositivo para que o programa possa ser executado no próprio PC.</p>
<p>Tomando um exemplo concreto vou tentar exemplificar como tornar o clássico &#8220;Olá benfica&#8221; numa aplicação mobile e executá-lo num telemóvel Nokia E60.</p>
<p>O telemóvel <a title="Especificações Nokia E60" href="http://developer.nokia.com/devices/E60" target="_blank">nókia E60</a> implementa as seguintes especificações Java Mobile Edition:</p>
<ul>
<li><strong>MIDP 2.0</strong></li>
<li><strong>CLDC 1.1</strong></li>
<li>JSR 120 Wireless Messaging API</li>
<li>JSR 135 Mobile Media API</li>
<li>JSR 172 Web Services API</li>
<li>JSR 177 Security and Trust Services API</li>
<li>JSR 179 Location API</li>
<li>JSR 180 SIP API</li>
<li>JSR 184 Mobile 3D Graphics API</li>
<li>JSR 185 JTWI</li>
<li>JSR 205 Wireless Messaging API</li>
<li>JSR 75 FileConnection and PIM API</li>
<li>JSR 82 Bluetooth API</li>
<li>Nokia UI API</li>
</ul>
<p>sendo constituído por um ecran de 356&#215;416 px, um processador  ARM 9 220Mhz, uma RAM de 64 mb. É mais potente que o Olivetti PC1!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifthenelsecontinue.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifthenelsecontinue.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifthenelsecontinue.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifthenelsecontinue.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifthenelsecontinue.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifthenelsecontinue.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifthenelsecontinue.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifthenelsecontinue.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifthenelsecontinue.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifthenelsecontinue.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifthenelsecontinue.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifthenelsecontinue.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=6&subd=ifthenelsecontinue&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifthenelsecontinue.wordpress.com/2007/12/02/introducao-ao-java-mobile-edition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/79a16a851b2db78ef2fd415a38396d00?s=96&#38;d=identicon" medium="image">
			<media:title type="html">lmen32</media:title>
		</media:content>
	</item>
		<item>
		<title>Documentação JAVA: APIs e especificações</title>
		<link>http://ifthenelsecontinue.wordpress.com/2007/12/01/como-obter-a-documentacao-sobre-as-classes-java-e-as-especificacoes/</link>
		<comments>http://ifthenelsecontinue.wordpress.com/2007/12/01/como-obter-a-documentacao-sobre-as-classes-java-e-as-especificacoes/#comments</comments>
		<pubDate>Sat, 01 Dec 2007 19:47:23 +0000</pubDate>
		<dc:creator>lmen32</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://ifthenelsecontinue.wordpress.com/2007/12/01/como-obter-a-documentacao-sobre-as-classes-java-e-as-especificacoes/</guid>
		<description><![CDATA[Quando se pergunta a um programador se ele sabe programar em Java, ele para  ser honesto tem de perguntar primeiro qual o ambiente de programação, é para ambiente  Desktop? é programação para o Servidor? é programação para um dispositivo móvel? isto porque um programador Java para além de ter de saber a sintaxe [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=5&subd=ifthenelsecontinue&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Quando se pergunta a um programador se ele sabe programar em Java, ele para  ser honesto tem de perguntar primeiro qual o ambiente de programação, é para ambiente  Desktop? é programação para o Servidor? é programação para um dispositivo móvel? isto porque um programador Java para além de ter de saber a sintaxe da linguagem, definição de uma classe, de uma interface, do ciclo while como acontecia com as linguagens Pascal, C++ por exemplo, tem também de saber como usar as APIs Swing, o modelo das Servlets, o ciclo de vida de uma página JSF entre outras especificações escondidas atrás da palavra Java.</p>
<p>Como é praticamente impossível a um programador saber tudo de cor, convêm ter à mão referências para consulta:</p>
<ul>
<li>Sobre os aspectos de sintaxe e comportamento da própria linguagem JAVA: <a title="Especificação da linguagem Java" href="http://java.sun.com/docs/books/jls/index.html" target="_blank">http://java.sun.com/docs/books/jls/index.html</a></li>
<li>A documentação JavaDoc da Api que acompanha a distribuição da SUN pode ser visualizada em : <a title="Sun JavaDoc Api" href="http://java.sun.com/javase/reference/api.jsp" target="_blank">http://java.sun.com/javase/reference/api.jsp</a>. O download  está em <a title="Download da linguagem da documentação JAVA" href="http://java.sun.com/javase/downloads/index.jsp#docs" target="_blank">http://java.sun.com/javase/downloads/index.jsp#docs</a></li>
<li>A documentação disponibilizada pela SUN tem um inconveniente: Não é pesquisável! A solução para este problema pode passar pelos seguintes sites:
<ul>
<li> <a title="Download do Javadoc em CHM" href="http://www.allimant.org/javadoc/" target="_blank">http://www.allimant.org/javadoc/</a> disponibiliza a documentação da SUN em  formato do windows help, que é facilmente pesquisável.<a title="Download do Javadoc em CHM" href="http://www.allimant.org/javadoc/" target="_blank"> </a></li>
</ul>
<ul>
<li> <a title="DocJar javadoc e source de classes" href="http://http://www.docjar.com/" target="_blank">http://www.docjar.com/</a> tem indexado não só o JavaDoc da Api da distribuição da SUN mas também de outras bibliotecas open source. Outra funcionalidade muito interessante do site é que ao mesmo tempo que se está a consultar a documentação de uma classe pode-se visualizar o seu código através do link <em>source</em>. Muito fixe!</li>
</ul>
</li>
<li>A definição de novas funcionalidades da linguagem Java e de todas as outras especificações como JSP, servlets é regida por um processo formal mas aberto à participação de terceiros designado pela SUN como Java Community Process . No site <a title="Java Community Process" href="http://www.jcp.org/en/jsr/tech" target="_blank">http://www.jcp.org/en/jsr/tech</a><br />
é possível aceder aos documentos das especificações. A cada especificação é atribuída um código na forma JSR NN (por exemplo, o código JSR 53 é da  especificação Servlet 2.3)   passando por várias fases até à sua versão final. Não é incomum que uma JSR tenha dois tipos de documentos: um documento descrevendo a API da especificação &#8211; útil para quem usa a especificação &#8211; e outro descrevendo pormenores de implementação &#8211; útil para os implementadores da especificação.</li>
</ul>
<p>Será que alguém quer partilhar outros link de interesse?</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifthenelsecontinue.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifthenelsecontinue.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifthenelsecontinue.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifthenelsecontinue.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifthenelsecontinue.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifthenelsecontinue.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifthenelsecontinue.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifthenelsecontinue.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifthenelsecontinue.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifthenelsecontinue.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifthenelsecontinue.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifthenelsecontinue.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=5&subd=ifthenelsecontinue&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifthenelsecontinue.wordpress.com/2007/12/01/como-obter-a-documentacao-sobre-as-classes-java-e-as-especificacoes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/79a16a851b2db78ef2fd415a38396d00?s=96&#38;d=identicon" medium="image">
			<media:title type="html">lmen32</media:title>
		</media:content>
	</item>
		<item>
		<title>Qual a linha, o método e a classe onde é invocado um método</title>
		<link>http://ifthenelsecontinue.wordpress.com/2007/11/22/4/</link>
		<comments>http://ifthenelsecontinue.wordpress.com/2007/11/22/4/#comments</comments>
		<pubDate>Thu, 22 Nov 2007 23:43:40 +0000</pubDate>
		<dc:creator>lmen32</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://ifthenelsecontinue.wordpress.com/2007/11/22/4/</guid>
		<description><![CDATA[As bibliotecas de logging como a Log4j entre outras tem a capacidade de adicionar à mensagem de debug indicada pelo programador, o nome da classe, método e número da linha onde foi colocada a mensagem de depuração.
Tendo a curiosidade de saber como é que a linguagem Java é usada para obter  informação em run-time [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=4&subd=ifthenelsecontinue&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>As bibliotecas de logging como a Log4j entre outras tem a capacidade de adicionar à mensagem de debug indicada pelo programador, o nome da classe, método e número da linha onde foi colocada a mensagem de depuração.</p>
<p>Tendo a curiosidade de saber como é que a linguagem Java é usada para obter  informação em run-time de onde um método está a ser chamado pesquisei na Net e deparei-me com a função <strong>Thread.currentThread().getStackTrace()</strong> que devolve um array com a informação da cadeia de invocações de métodos. O índice zero corresponde à última função chamada, neste caso, a própria getStackTrace() (fixe!), o índice 1 ao penúltimo invocado, etc,. Ou seja é a informação presente no printStack de uma Excepção.</p>
<p>O método writeInfo tenta reproduzir simplisticamente a funcionalidade nuclear das bibliotecas de Logging.</p>
<pre>public class DebugInfo {           public static class debug {                   	public void <strong>writeInfo</strong>(String msg)         {              		StackTraceElement[] stack = Thread.currentThread().getStackTrace();              		StackTraceElement el= stack[2];               		System.out.format("ficheiro:%s class:%s método:%s linha:%s ==&gt; %s",                      		el.getFileName(),                      		el.getClassName(),                       		el.getMethodName(),                       		el.getLineNumber(),                      		msg);          	}      	}           	public static void main(String[] args) {                   		debug d = new debug();          		d.writeInfo("benfica");           	}  }</pre>
<p>que devolverá,</p>
<pre>ficheiro:DebugInfo.java class:tapete.DebugInfo método:main linha:23 ==&gt; benfica</pre>
<p><strong>Nota:</strong>Esta técnica só funciona em Java 5.0.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifthenelsecontinue.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifthenelsecontinue.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifthenelsecontinue.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifthenelsecontinue.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifthenelsecontinue.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifthenelsecontinue.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifthenelsecontinue.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifthenelsecontinue.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifthenelsecontinue.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifthenelsecontinue.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifthenelsecontinue.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifthenelsecontinue.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=4&subd=ifthenelsecontinue&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifthenelsecontinue.wordpress.com/2007/11/22/4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/79a16a851b2db78ef2fd415a38396d00?s=96&#38;d=identicon" medium="image">
			<media:title type="html">lmen32</media:title>
		</media:content>
	</item>
		<item>
		<title>A existência de arrays com tamanho zero</title>
		<link>http://ifthenelsecontinue.wordpress.com/2007/11/22/a-existencia-de-arrays-com-tamanho-zero/</link>
		<comments>http://ifthenelsecontinue.wordpress.com/2007/11/22/a-existencia-de-arrays-com-tamanho-zero/#comments</comments>
		<pubDate>Thu, 22 Nov 2007 23:28:15 +0000</pubDate>
		<dc:creator>lmen32</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[arrays]]></category>

		<guid isPermaLink="false">http://ifthenelsecontinue.wordpress.com/2007/11/22/a-existencia-de-arrays-com-tamanho-zero/</guid>
		<description><![CDATA[Ao ler o livro Efective Java deparei-me com uma característica da linguagem Java que pensava que não existia: os arrays podem ter zero elementos.
É possível fazer,
String[] a = new String[0];
System.out.println("não é null:" + (a==null));
System.out.println("O tamanho é:" + a.length);
 for(String s :a)
 {
        System.out.println(s);
 }
que devolve,
não é null:false
O tamanho [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=3&subd=ifthenelsecontinue&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Ao ler o livro Efective Java deparei-me com uma característica da linguagem Java que pensava que não existia: os <strong>arrays</strong> podem ter zero elementos.</p>
<p>É possível fazer,</p>
<pre><strong><font color="#ff6600">String[] a = new String[0];</font>
System.out.println("não é null:" + (a==null));
System.out.println("O tamanho é:" + a.length);
 for(String s :a)
 {
        System.out.println(s);
 }</strong></pre>
<p>que devolve,</p>
<pre><strong>não é null:false
O tamanho é:0 </strong></pre>
<p>A recomendação do livro é que quando <u>um método retorna um array, ele deve retornar um array com tamanho zero em vez de devolver NULL</u>. Desta forma evita-se o recurso ao if para testar se o retorno é null ou se há valor, como é o caso da linguagem C++. Como exemplo desta recomendação observe-se a java.lang.List.</p>
<pre><strong>List&lt;String&gt; l = new ArrayList&lt;String&gt;();
String[] la = l.toArray(new String[0]);
System.out.println("la.length = " + la.length);</strong></pre>
<p>que devolve,</p>
<pre><strong>la.length = 0 </strong></pre>
<p>O pedaço de código não funcionaria da mesma forma e o array fornecido tivesse inicialmente elementos no array,</p>
<pre><strong>String[] laNull = l.toArray(<font color="#ff6600">new String[1]</font>);
System.out.println("la.length = " + la.length);
for(String s :laNull)
{
    System.out.println(s);
}</strong></pre>
<p>que devolve,</p>
<pre><strong>la.length = 0
null </strong></pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifthenelsecontinue.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifthenelsecontinue.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifthenelsecontinue.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifthenelsecontinue.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifthenelsecontinue.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifthenelsecontinue.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifthenelsecontinue.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifthenelsecontinue.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifthenelsecontinue.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifthenelsecontinue.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifthenelsecontinue.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifthenelsecontinue.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifthenelsecontinue.wordpress.com&blog=1401746&post=3&subd=ifthenelsecontinue&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifthenelsecontinue.wordpress.com/2007/11/22/a-existencia-de-arrays-com-tamanho-zero/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/79a16a851b2db78ef2fd415a38396d00?s=96&#38;d=identicon" medium="image">
			<media:title type="html">lmen32</media:title>
		</media:content>
	</item>
	</channel>
</rss>