Bugs: Browse | Submit New | Admin

[#4500] Webrick: Missing -c parameter forces utf-8 even if with code page specified in meta tag

Date:
2006-05-17 14:44
Priority:
3
Submitted By:
Jörg Rohrschneider (styerk)
Assigned To:
Akinori MUSHA (knu)
Category:
Network / Comm / Protocols
State:
Open
Platform:
 
Summary:
Webrick: Missing -c parameter forces utf-8 even if with code page specified in meta tag

Detailed description
Seen on radrails 0.6.4 using ruby 1.8.2 which contains webrick 1.3.1:
(on Windows)

When starting a webrick server without the -c parameter, it uses
use the UTF-8 code page as default. 
If there is a different code page specified in 
the <meta ... content-type=> tag in the HTML header, the specified
code page should be used;

That does not work; webrick ALWAYS seems to use UTF-8 even if a different 
one is specified by a meta tag.

The same happens when I use '-c utf-8'; it does not use utf-8
as default, but as a forced code page.


Add A Comment: Notepad

Please login


Followup

Message
Date: 2006-05-17 16:21
Sender: Jörg Rohrschneider

OK,
that seems to be a workaround;
(BTW, where exactly do I put that line? It seems I have to
insert it into each single action of the controller, 
can I define that globally for the controller?)

But anyway, the observed behaviour does not seem consistent
to me;
It behaves different if I call webrick with '-c utf-8' than
when calling it with, say '-c latin5' or whatever:
-c utf-8: ignore EVERY <meta... > specification of a code
page;
-c latin5: use the <meta>- specified code page if present,
otherwise use latin5

Date: 2006-05-17 15:17
Sender: Marcus Rueckert

html header != http header
if the 2 headers dont match the browser will rely on the HTTP
header.

insert my line in your controller.
setting @header doesnt refer to the HTML header but to the HTTP
header.
Date: 2006-05-17 15:00
Sender: Jörg Rohrschneider

That is what I did;
I just did it explicitly by typing

<html>
  <meta http-equiv="Content-Type"
content="text/html;
charset=latin1">
...
</html>

into the standard layout.

The point is, this specification gets completely ignored if
webrick is started either with '-c utf-8' or without -c.

If I use, say '-c latin5', everything works as it should.

Date: 2006-05-17 14:55
Sender: Marcus Rueckert

you can set the content type header from your rails app. i dont
think the web/application server should parse the output.

if you want to set a different content type header use:
[[[
@headers["Content-Type"] = "text/html
; charset=ISO-8859-1"
]]]

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
assigned_tonone2007-06-12 02:25zenspider
category_idMisc / Other Standard Library2007-05-29 20:49zenspider