<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">The most unixy way is to treat everything as binary UTF-8 and then forget about encodings. The following program works just fine:<br>
<br><pre class=""><span style="color:rgb(72,61,139)">#include</span> <span style="color:rgb(0,139,0)"><stdio.h></span>
<span style="color:rgb(34,139,34)">int</span> <span style="color:rgb(0,0,255)">main</span>()
{
printf(<span style="color:rgb(0,139,0)">"Hello שלום!\n"</span>);
}<br><br></pre><pre class="">Compile with:<br><br>cc -o hello hello.c
./hello<br>Hello שלום!<br><br></pre>(Though שלום is inversed in the terminal).<br><br><br></div><div style id="divCleekiAttrib"></div><div style id="divCleekiAttrib"></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Sun, Jan 12, 2014 at 9:02 PM, Baruch Siach <span dir="ltr"><<a href="mailto:baruch@tkos.co.il" target="_blank">baruch@tkos.co.il</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Dov,<br>
<div class="im"><br>
On Sun, Jan 12, 2014 at 08:53:38PM +0200, Dov Grobgeld wrote:<br>
> Writing hebrew to the terminal is a bad idea because terminals do not<br>
> support BiDi reordering.<br>
><br>
> That said, doing "cat small-hello.utf8"[1] works for me in gnome-term<br>
> (though it is reversed). No special environment variables were defined.<br>
<br>
</div>But Ori has specifically asked about sending just one character to terminal.<br>
cat treats everything like binary data.<br>
<br>
baruch<br>
<div class="HOEnZb"><div class="h5"><br>
> On Sun, Jan 12, 2014 at 8:34 PM, Ori Idan <<a href="mailto:ori@helicontech.co.il">ori@helicontech.co.il</a>> wrote:<br>
> > I need to print several Hebrew characters (UTF-8) to the terminal.<br>
> > My locale is set to he_IL.UTF-8 so it shows Hebrew on the terminal,<br>
> > however printing from C gives me Chinese characters.<br>
> > My question is how to print one character such as 'א' to the terminal.<br>
> ><br>
> > --<br>
> > Ori Idan<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
<a href="http://baruch.siach.name/blog/" target="_blank">http://baruch.siach.name/blog/</a> ~. .~ Tk Open Systems<br>
=}------------------------------------------------ooO--U--Ooo------------{=<br>
- <a href="mailto:baruch@tkos.co.il">baruch@tkos.co.il</a> - tel: <a href="tel:%2B972.2.679.5364" value="+97226795364">+972.2.679.5364</a>, <a href="http://www.tkos.co.il" target="_blank">http://www.tkos.co.il</a> -<br>
</font></span></blockquote></div><br></div>