[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Windows command & unicode

Maarten Boonen

11/15/2006 4:06:00 PM

Hi all,

I have a problem using unicode characters in the windows command.

As a very simple example, when I type this:

H:\>ruby -e 'puts "rien à faire"'

I will get the following:

rien Ó faire

Does anyone know what causes this?
When I run my scripts from Scite, this problem doesn't come up.

Kind regards,
Maarten

3 Answers

Wilson Bilkovich

11/15/2006 4:29:00 PM

0

On 11/15/06, m44rt3n@yahoo.com <m44rt3n@yahoo.com> wrote:
> Hi all,
>
> I have a problem using unicode characters in the windows command.
>
> As a very simple example, when I type this:
>
> H:\>ruby -e 'puts "rien à faire"'
>
> I will get the following:
>
> rien Ó faire
>
> Does anyone know what causes this?
> When I run my scripts from Scite, this problem doesn't come up.
>

I believe the Windows command prompt displays text using the system
codepage (the Regional Settings control panel). I'm not aware of a way
to make it treat things as real UTF-8.

Let me know if you figure it out, though. Heh.

Austin Ziegler

11/15/2006 4:49:00 PM

0

On 11/15/06, m44rt3n@yahoo.com <m44rt3n@yahoo.com> wrote:
> Hi all,
>
> I have a problem using unicode characters in the windows command.
>
> As a very simple example, when I type this:
>
> H:\>ruby -e 'puts "rien à faire"'
>
> I will get the following:
>
> rien Ó faire
>
> Does anyone know what causes this?
> When I run my scripts from Scite, this problem doesn't come up.

Please search the archives. There was a discussion about the
limitations of cmd.exe and Unicode. What you want generally can't be
done from the command-line in Windows.

-austin
--
Austin Ziegler * halostatue@gmail.com * http://www.halo...
* austin@halostatue.ca * http://www.halo...feed/
* austin@zieglers.ca

Maarten Boonen

11/15/2006 7:56:00 PM

0



On Nov 15, 5:48 pm, "Austin Ziegler" <halosta...@gmail.com> wrote:
> On 11/15/06, m44r...@yahoo.com <m44r...@yahoo.com> wrote:
>
> > Hi all,
>
> > I have a problem usingunicodecharacters in the windows command.
>
> > As a very simple example, when I type this:
>
> > H:\>ruby -e 'puts "rien à faire"'
>
> > I will get the following:
>
> > rien Ó faire
>
> > Does anyone know what causes this?
> > When I run my scripts from Scite, this problem doesn't come up.Please search the archives. There was a discussion about the
> limitations ofcmd.exeandUnicode. What you want generally can't be
> done from the command-line in Windows.
>
> -austin
> --
> Austin Ziegler * halosta...@gmail.com *http://www.halo...
> * aus...@halostatue.ca *http://www.halo...feed/
> * aus...@zieglers.ca


Thanks, this got me on my way.

It seems this works:

require 'iconv'
puts Iconv.new("ibm850","iso-8859-1").iconv("rien à faire")