hi all, I put a ° in a string but when I render it to the screen the ° changes in <?> block. The rest of the string is renderen correctly. How is this caused? Thanks Stijn --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 10/4/07, Tarscher <tarscher@gmail.com> wrote:> > hi all, > > I put a � in a string but when I render it to the screen the � changes > in <?> block. The rest of the string is renderen correctly. > > How is this caused? >http://www.joelonsoftware.com/articles/Unicode.html Sincerely, Isak> Thanks > Stijn > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 10/4/07, Tarscher <tarscher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > hi all, > > I put a ° in a string but when I render it to the screen the ° changes > in <?> block. The rest of the string is renderen correctly.By default, Rails tells the browser that the content type for your pages is UTF-8. If your templates are using a different encoding, that will cause the problem you''re seeing. --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Many thanks for the reply. It''s still not clear thuogh. My page that renders the questionmark has: <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> ... Shouldn''t that be sufficient to render the exotic caracter? Regards, Stijn On 4 okt, 14:52, "Bob Showalter" <showa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 10/4/07,Tarscher<tarsc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > hi all, > > > I put a � in a string but when I render it to the screen the � changes > > in <?> block. The rest of the string is renderen correctly. > > By default, Rails tells the browser that the content type for your > pages is UTF-8. If your templates are using a different encoding, that > will cause the problem you''re seeing.--~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Tarscher wrote:> Many thanks for the reply. It''s still not clear thuogh. > > My page that renders the questionmark has: > <head> > <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> > ... > > Shouldn''t that be sufficient to render the exotic caracter?Is the character in a variable or hardcoded in the template? If it''s hardcoded, you need to ensure your editor is saving your template as UTF-8. If it''s a variable, you need to ensure you have all the Ruby I18N configuration set up correctly for UTF-8. -- 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 10/8/07, Tarscher <tarscher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Many thanks for the reply. It''s still not clear thuogh. > > My page that renders the questionmark has: > <head> > <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> > ... > > Shouldn''t that be sufficient to render the exotic caracter?No, not if the character is not actually UTF-8. Your editor has to be saving as UTF-8 as well. Let''s look at the "degree" character: The Unicode code point is 0176 decimal (hex 00B0). The Latin1 encoding is one byte: 0xB0 However, the UTF-8 encoding is *two* bytes: C2 B0 Now, suppose your editor is set to use Latin1. You will see a degree character on the screen in your editor. When you save the file, the editor will write this a a single 0xB0 byte (since that''s how you represent this symbol in Latin1 encoding). Now, when the template gets sent to the browser, you''ve told it that you''re sending UTF-8. As the data is sent, the browser tries to interpret the 0xB0 as a UTF-8 sequence and it gets confused, because 0xB0 is not a legal UTF-8 sequence. So, since it doesn''t know what you''re trying to do, it shows a question mark or some other marker character. Make sense? --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---