Again: invalid byte sequence in US-ASCII

Hello everybody,

again I have problems with the f.ckn german umlauts :wink: 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”

Do You have a hint for me?

Thanks a lot,
greetings
Sven

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? […]

Content analysis details: (-2.9 points, 5.0 required)

pts rule name description



-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
[score: 0.0000]
X-Cloudmark-Analysis: v=1.1
cv=CqMFsqQC4gx7bBgpmnW/wKYuJF/a5pXPeCAfngFtYkU= c=1 sm=0
a=CPlwVjms4CEA:10 a=GyCUoYqlGUsA:10 a=IkcTkHD0fZMA:10
a=Awv8PiAk2CnYZYvpkvQA:9 a=QEXdDO2ut3YA:10
a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Precedence: bulk
Lines: 15
List-Id: ruby-talk.ruby-lang.org
List-Software: fml [fml 4.0.3 release (20011202/4.0.3)]
List-Post: mailto:[email protected]
List-Owner: mailto:[email protected]
List-Help: mailto:[email protected]?body=help
List-Unsubscribe: mailto:[email protected]?body=unsubscribe
Received-SPF: none (Address does not pass the Sender Policy Framework)
SPF=FROM;
[email protected];
remoteip=::ffff:221.186.184.68;
remotehost=carbon.ruby-lang.org;
helo=carbon.ruby-lang.org;
receiver=eq4.andreas-s.net;

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?

Could you provide a short self-contained example?

thx

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