Ralph Shnelvar wrote:
>> Yes, that seems to be Latin-1.  Why are you using Latin-1 and not 
>> UTF-{8|16} in the first place?  They are supersets of Latin-1.
> 
> I am aware of this, Marnen.
> 
> What I don't know is how to get Ruby/Rails to generate UTF-8 and/or 
> Unicode.

Why do you think you need to do something special here?  Rails doesn't 
"generate" text, for the most part; it just manipulates and hands back 
what you give it.

In other words:
1. Given the ASCII string "Ralph Shnelvar", how would you have Rails 
print "Ralph Shnelvar"?  (Hint:you should already know the answer to 
this.)

2. Given the UTF-8 string "ラルフ・シュネルヴァー", how would you have Rails print 
"ラルフ・シュネルヴァー"?  (Hint: the answer is the same as for #1.)

Of course, you need to set the proper encoding headers in your HTML, and 
you need to have your DB encoding be UTF-8, but those are external to 
Rails.

[...]
>> * You've declared your document as XHTML, but not used an <?xml ?> 
>> prolog.  Therefore, it will be interpreted as UTF-8 as described at 
>> http://www.w3.org/International/O-charset .
> 
> 
> OK ... that sounds like the problem ... I think.

I believe that's the immediate problem, yes.

> 
>> 
>> * But you shouldn't be generating XHTML anyway.  Browser support for 
>> XHTML is extremely problematic.  See http://hixie.ch/advocacy/xhtml for 
>> further information.  Use HTML 4 or 5 instead.  If you use HTML 4, make 
>> sure to install the html_output plugin so that Rails will not use the 
>> XML-style <self-closing tag/> syntax, which is not valid in HTML 4.
> 
> Ok ... which do you recommend ... 4 or 5?

I've been using HTML 4.  I don't know how well HTML 5 is supported by 
browsers currently in use, but that's because I haven't done the 
research yet.  I'm sure others know more than I do on this point.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to