<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>(non-allegro) How do I handle non-american characters in a console application?</title>
		<link>http://www.allegro.cc/forums/view/590542</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 16 Mar 2007 05:14:47 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I am building a console application in Dev C++, which does some operations on words that are either input from keyboard or read from files. </p><p>It&#39;s a very basic program with mostly char arrays and comparison between them.</p><p>All it does is compare the char values contained in these words, for example it could ask you for a password to enter the program and then check in a data file if the password is correct.</p><p>I have 1 problem with this: I live in Sweden and we use some characters that are non-american, such as å ä ö.  The program cannot handle this, instead these characters become strange other things.</p><p>I have also seen that é  for example, becomes Ú when input into the program.</p><p>It seems that every character that the program cannot handle, has a specific character that it becomes instead (as with é above), so it would probably be possible to handle each such character by itself and convert inside the program (that is, if I recieve an é, it becomes an Ù but then I can change it back with error checking inside the program).</p><p>But that&#39;s quite a bit of work looking up every specific character.</p><p>Is there some way to make the program support non-english characters by #include a file or something to do this?</p><p>Thanks for your help,</p><p>Emil
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (emilb)</author>
		<pubDate>Wed, 14 Mar 2007 17:08:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/set_uformat" target="_blank"><span class="a">set_uformat</span></a><span class="k2">(</span><span class="k2">)</span>
<a href="http://www.allegro.cc/manual/ureadkey" target="_blank"><span class="a">ureadkey</span></a><span class="k2">(</span><span class="k2">)</span>
</pre></div></div><p>

<a href="http://alleg.sourceforge.net/stabledocs/en/alleg002.html">Unicode routines</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Wed, 14 Mar 2007 17:14:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>emilb, it is like gnolam said.  What&#39;s happening is that your program is trying to calculate your input as ASCII, where you should actually be using Unicode so it can calculate the region code (ie Swedish).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeamTerradactyl)</author>
		<pubDate>Thu, 15 Mar 2007 01:19:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks for telling me this. </p><p>I am currently not using allegro in this project, but I suppose I can do it and still be in the console and do the same things. </p><p>Is there a way to be able to do this without using allegro, though?<br />The original program was only running in the console with iostream and fstream loaded, and I started making tables of characters on my own, to be able to repair the char*  arrays that were in bad condition after entering åäö and similar things.</p><p>I&#39;ll try this with allegro and see if I can make it work in the console, without changing the gfx mode.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (emilb)</author>
		<pubDate>Thu, 15 Mar 2007 01:48:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You need to somehow get the encoding right. UTF8, Windows, DOS, Apple, whatever it is...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tobias Dammers)</author>
		<pubDate>Thu, 15 Mar 2007 02:34:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I know that <a href="http://www.cppreference.com">cppreference.com</a> talks about <b>wchar_t</b>, and so I don&#39;t know if that&#39;s what you&#39;re looking for:</p><p><a href="http://www.cppreference.com/data_types.html">http://www.cppreference.com/data_types.html</a><br />or<br /><a href="http://www.cppreference.com/keywords/wchar_t.html">http://www.cppreference.com/keywords/wchar_t.html</a></p><p>You may try defining your input as type <b>wchar_t</b> and doing a <b>cin &gt;&gt;</b> or whatever.  On the &quot;data_types&quot; page, however, it mentions that it&#39;s newly introduced to C++ (not C).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeamTerradactyl)</author>
		<pubDate>Thu, 15 Mar 2007 02:39:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Does the Windows console use unicode? I thought it still used DOS code-pages.  I think you need a Swedish system.fnt
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matt Smith)</author>
		<pubDate>Fri, 16 Mar 2007 00:44:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I assume you are on Windows.  Then your source code is probably in Windows-1252, and your console likely uses code page 850.</p><p>Both code pages are listed here:<br /><a href="http://en.wikipedia.org/wiki/Western_Latin_character_sets_%28computing%29#Comparison_table">http://en.wikipedia.org/wiki/Western_Latin_character_sets_%28computing%29#Comparison_table</a></p><p>You just need two arrays to convert back and forth between these encodings.  The data you need is probably on the web somewhere, so you don&#39;t have to type it out yourself.  I haven&#39;t had the need to do this myself, so I can&#39;t tell the quickest way to get this working.</p><p>The iconv lib supposedly can do this.</p><p><a href="http://gnuwin32.sourceforge.net/packages/libiconv.htm">http://gnuwin32.sourceforge.net/packages/libiconv.htm</a></p><p>Online docs here:<br /><a href="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Fri, 16 Mar 2007 05:14:47 +0000</pubDate>
	</item>
</rss>
