again I have problems with the f.ckn german umlauts This time within
a cgi script.
I try to parse the output from a shell script, e.g.: ‘Ich habe viele
Wünsche’
While reading ruby (1.9.2) complains with “invalid byte sequence in
US-ASCII” so I tried to enforce utf8.
Now the reading works, but on my website I get the output “Ich habe
viele W\u00FCnsche”
Content preview: Hi, On 01.05.2011 13:11, Sven K. wrote: > I try
to parse
the output from a shell script, e.g.: ‘Ich habe viele > Wünsche’ >
While
reading ruby (1.9.2) complains with “invalid byte sequence in >
US-ASCII”
so I tried to enforce utf8. > Now the reading works, but on my
website I
get the output “Ich habe > viele W\u00FCnsche” > > Do You have a hint
for
me? […]
I try to parse the output from a shell script, e.g.: ‘Ich habe viele
Wünsche’
While reading ruby (1.9.2) complains with “invalid byte sequence in
US-ASCII” so I tried to enforce utf8.
Now the reading works, but on my website I get the output “Ich habe
viele W\u00FCnsche”
Oh my good, I am such an idiot. Forgive me for steeling Your time!
Here is the solution:
Put this in the html header:
So just to explain for future reference: I got the input from the bash.
Ruby expects us-ascii, therefore I enforced utf-8:
string.force_encoding(‘utf-8’)
The next step is to enforce the webbrowser to use utf-8 for reading the
site. That is done by the charset-option in the content directive:
Again: so sorry, that was such a silly mistake!
Have a nice weekend,
best,
Sven
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.