Hi,
in the terminal I made
verbes =[“Abaisser”,“Accder”]
and then
verbes.include?(“Accder”)
with => true
on a Mac terminal.
Is it special for Windows Vista?
Max
Von: ruby-talk [[email protected]]" im Auftrag von
"[email protected] [[email protected]]
Gesendet: Samstag, 18. Oktober 2014 10:29
An: Ruby users
Betreff: Dealing with accents
Hi!
I have an array containing a list of french verbs.
Ex : verbes =[“Abaisser”,“Accder”]
If I print out this array on Windows Vista cmd I get as an output :
[“Abaisser”,“Accder”] which is great.
Now if from the cmd I enter a verb to test if this verb is included in
the array, it will work ok with “Abaisser” but not with “Accder” and I
suppose it’s because of the “”.
Any idea how I could fix this ? Thanks
Ronan
Envoy de mon smartphone BlackBerry 10 sur le rseau SFR.
Probably an encoding problem, dont know what text editor you use but
there should be an option to save as Unicode or ms-dos, something like
that, try that for the source code file.
De: Max H.
Envoy:
samedi 18 octobre 2014 12:13
: Ruby
users
Rpondre : Ruby users
Objet: AW:
Dealing with accents
|
verbes =["Abaisser","Accder"]
and then
verbes.include?("Accder")
with => true
on a Mac terminal.
Is it special for Windows Vista?
Max
Gesendet: Samstag, 18. Oktober 2014 10:29
An: Ruby users
Betreff: Dealing with accents
On Oct 18, 2014, at 7:21, [email protected] wrote:
My file is UTF-8 encoded and the output in the cmd is ok, if I print it out I
get what I want.
Your file is internal encoding. You’re getting input from the user or a
file. That’s external encoding.
[email protected] writes:
Now if from the cmd I enter a verb
The Windows CMD is probably the worst console around. It doesn’t do
UTF-8 by default, you have to manually issue a `chcp’ command to switch
to UTF-8, and even then the console font does not support most Unicode
characters. I’ve not used the Windows console for quite a long time, but
I do remember that dealing with anything that wasn’t ASCII was horrible.
See here for more information:
How can I use Unicode characters on the Windows command line? - Stack Overflow
Vale,
Quintus
–
Blog: http://www.quintilianus.eu
I will reject HTML emails. | Ich akzeptiere keine HTML-Nachrichten.
|
Use GnuPG for mail encryption: | GnuPG für Mail-Verschlüsselung:
http://www.gnupg.org | The GNU Privacy Guard
De: Josh Karamuth
Envoyé:
samedi 18 octobre 2014 14:47
À: Ruby
users
Répondre à: Ruby users
Objet:
Re: Dealing with accents
|
I should try this one.From the command I ask user to enter a verb and then it verifies the verb is contained in the array.Ex (on cmd)Enter a verb : AccéderNo verb such as Accéder.Never tried it on IRB though.Envoyé de mon smartphone BlackBerry 10 sur le réseau SFR.
De: Max HaasEnvoyé: samedi 18 octobre 2014 12:13À: Ruby usersRépondre à: Ruby usersObjet: AW: Dealing with accentsHi,in the terminal I madeverbes =["Abaisser","Accéder"]
and then
verbes.include?("Accéder")
with => true
on a Mac terminal.
Is it special for Windows Vista?
Max
Von: ruby-talk [[email protected]]" im Auftrag von "[email protected] [[email protected]]
Gesendet: Samstag, 18. Oktober 2014 10:29
An: Ruby users
Betreff: Dealing with accents
Hi!I have an array containing a list of french verbs.Ex : verbes =["Abaisser","Accéder"]If I print out this array on Windows Vista cmd I get as an output : ["Abaisser","Accéder"] which is great.Now if from the cmd I enter a verb to test if this verb is included in the array, it will work ok with "Abaisser" but not with "Accéder" and I suppose it's because of the "é".Any idea how I could fix this ? ThanksRonanEnvoyé de mon smartphone BlackBerry 10 sur le réseau SFR.
Hi,
I think I got it !
In my code :
test = gets.chomp.encode!(“UTF-8”)
Then as user is invited to enter a verb, he he puts “accéder”, he will
get as an output :
Accéder is in the array.
It works fine now.
Thanks for help.
Envoyé de mon smartphone BlackBerry 10 sur le réseau SFR.
Message d’origine
De: Quintus
Envoyé: dimanche 19 octobre 2014 09:20
À: [email protected]
Répondre à: Ruby users
Objet: Re: Dealing with accents
[email protected] writes:
Now if from the cmd I enter a verb
The Windows CMD is probably the worst console around. It doesn’t do
UTF-8 by default, you have to manually issue a `chcp’ command to switch
to UTF-8, and even then the console font does not support most Unicode
characters. I’ve not used the Windows console for quite a long time, but
I do remember that dealing with anything that wasn’t ASCII was horrible.
See here for more information:
Vale,
Quintus
–
Blog: http://www.quintilianus.eu
I will reject HTML emails. | Ich akzeptiere keine HTML-Nachrichten.
|
Use GnuPG for mail encryption: | GnuPG für Mail-Verschlüsselung:
http://www.gnupg.org | The GNU Privacy Guard
Thanks.
I got this information once but had no need of it by the time.
I shall try.
As an example for “Accéder” in my Ruby array, it prints out as
“Acc\u00E9der”.
But I also get a false statement if I ask if "Acc\u00E9der" is in my
array, which seems logical.
Envoyé de mon smartphone BlackBerry 10 sur le réseau SFR.
Message d’origine
De: Quintus
Envoyé: dimanche 19 octobre 2014 09:20
À: [email protected]
Répondre à: Ruby users
Objet: Re: Dealing with accents
[email protected] writes:
Now if from the cmd I enter a verb
The Windows CMD is probably the worst console around. It doesn’t do
UTF-8 by default, you have to manually issue a `chcp’ command to switch
to UTF-8, and even then the console font does not support most Unicode
characters. I’ve not used the Windows console for quite a long time, but
I do remember that dealing with anything that wasn’t ASCII was horrible.
See here for more information:
Vale,
Quintus
–
Blog: http://www.quintilianus.eu
I will reject HTML emails. | Ich akzeptiere keine HTML-Nachrichten.
|
Use GnuPG for mail encryption: | GnuPG für Mail-Verschlüsselung:
http://www.gnupg.org | The GNU Privacy Guard