Boa tarde pessoal. Estou utilizando o intant rails com ruby v.1.8.6 e rails 2.0.2 com um servidor sqlserver2000, minha base de dados usa o collation SQL_latin1_general_CP1_CI_AS, quando tragos strings com acentuação e cedilha não consigo visualizar os carateres corretos, sei que para exibir corretamente o texto no ruby tenho que usar UTF-8. Como posso fazer pra mudar o collation da minha base ou converter as string para UTF-8 na hora de exibir? Desde já agradeço Eduardo -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Peço desculpas pelo meu Português. Estou usando o Google Translate. :-) Você precisa informar o arquivo database.yml que pretende conversar com o banco de dados em UTF-8. Para fazer isso adicione encoding: utf8 para o seu banco de dados no database.yml. Deixe-me saber como isso vai. Obrigado, B. 2011/2/23 Edu Mariano <edumariano-I4oVjbygTnVfyO9Q7EP/yw@public.gmane.org>:> Boa tarde pessoal. > > Estou utilizando o intant rails com ruby v.1.8.6 e rails 2.0.2 com um > servidor sqlserver2000, minha base de dados usa o collation > SQL_latin1_general_CP1_CI_AS, quando tragos strings com acentuação e > cedilha não consigo visualizar os carateres corretos, sei que para > exibir corretamente o texto no ruby tenho que usar UTF-8. Como posso > fazer pra mudar o collation da minha base ou converter as string para > UTF-8 na hora de exibir? > > Desde já agradeço > Eduardo > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
2011/2/23 Bryan Crossland <bacrossland-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> Peço desculpas pelo meu Português. Estou usando o Google Translate. :-)Por favor, pare top postagem -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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 Wed, Feb 23, 2011 at 1:21 PM, Michael Pavling <pavling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Por favor, pare top postagemhttp://en.wikipedia.org/wiki/Posting_style "The traditional style was for a long time to post the answer below as much of the quoted original as was necessary to understand the reply (bottom or inline). *Many years later, when email became widespread in business communication, it however became a widespread policy to reply above the entire original and leave it untouched (and without any prefixes at the beginning of each line) below the reply.*" -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? On 23 February 2011 22:42, Bryan Crossland <bacrossland-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Wed, Feb 23, 2011 at 1:21 PM, Michael Pavling <pavling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Por favor, pare top postagem > > "The traditional style was for a long time to post the answer below as much > of the quoted original as was necessary to understand the reply (bottom or > inline). Many years later, when email became widespread in business > communication, it however became a widespread policy to reply above the > entire original and leave it untouched (and without any prefixes at the > beginning of each line) below the reply."This list isn''t a business communication - it''s a reference resource, and that "policy" was imposed because one company''s email software that just "did it that way" - irregardless of any user preference.>http://en.wikipedia.org/wiki/Posting_styleRead the whole of that article... especially the section on "Choosing the proper posting style". If after that you still insist on top-posting, so be it :-/ *shrug* -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I reply to the email that I receive which uses the standard method of top posting. Why? Because if you bottom-posted all the time or unnecessarily inline quoted it would make this thread: http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/6c25db52c2d743aaand others like it unreadable. I''m done discussing posting styles. Let''s return to helping each other out which is the main reason for this group. On Wed, Feb 23, 2011 at 4:50 PM, Michael Pavling <pavling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> A: Because it messes up the order in which people normally read text. > Q: Why is top-posting such a bad thing? > A: Top-posting. > Q: What is the most annoying thing in e-mail? > > > On 23 February 2011 22:42, Bryan Crossland <bacrossland-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On Wed, Feb 23, 2011 at 1:21 PM, Michael Pavling <pavling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > >> Por favor, pare top postagem > > > > "The traditional style was for a long time to post the answer below as > much > > of the quoted original as was necessary to understand the reply (bottom > or > > inline). Many years later, when email became widespread in business > > communication, it however became a widespread policy to reply above the > > entire original and leave it untouched (and without any prefixes at the > > beginning of each line) below the reply." > > This list isn''t a business communication - it''s a reference resource, > and that "policy" was imposed because one company''s email software > that just "did it that way" - irregardless of any user preference. > > >http://en.wikipedia.org/wiki/Posting_style > > Read the whole of that article... especially the section on "Choosing > the proper posting style". If after that you still insist on > top-posting, so be it :-/ > *shrug* > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 February 2011 23:07, Bryan Crossland <bacrossland-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I reply to the email that I receive which uses the standard method of top > posting.What "standard"? Which RFC says that there is any "standard"?> if you .... unnecessarily > inline quoted it would make this thread: > http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/6c25db52c2d743aa > and others like it unreadable.no... top-posting makes it impossible to maintain a coherent conversation, and introduces confusion about what replies refer to, because there''s no context.> I''m done discussing posting styles.So I guess you *didn''t* bother reading the rest of the article you waved as defence of your position? ... hence my *shrug* PS You''ve got a frightfully annoying email client too, which sends *to* the person, and CCs the group - so further replies go to you, not the group... :-/ -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Eu tentei usar o encoding: utf8 no database.yml, mas para o sql server não funciona. tentei então um helper para a classe string com o seguinte código -----------------------------------------------------------code starts here----------------------------------------------------------------------- class String # Returns a valid DateTime object if the object can be converted according to +format+, nil otherwise. # FIXME: Corrigir o erro de validação em colunas contendo data + hora. gem ''chardet'' require ''UniversalDetector'' def parse_date(format ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS[:default]) begin DateTime.strptime(self, format) rescue ArgumentError end end def to_utf8 @encode_type = UniversalDetector::chardet(self)["encoding"] #detects the str encoding Iconv.iconv("UTF-8", @encode_type, self).to_s #converts the current encoding to UTF-8 of the present string end end -----------------------------------------------------------code ends here----------------------------------------------------------------------- O chardet é uma gem que pode retornar o tipo de codificação utilizada na string, o tipo de codificação retornado para o SQL_latin1_genreal_CP1_CI_AS é o ISO-8859-5 e o iconv consegue passar a string para utf8, porém os resultados ainda não são satisfatórios pois os caracteres acentuados e as cedilhas não são exibidos corretamente. Veja abaixo: O que deveria exibir: Fundação Ecumênica de Proteção ao Excepcional - PARANC está exibindo: Fundaчуo Ecumъnica de Proteчуo ao Excepcional - PARANС Sinto que estou chegando perto, alguém sabe como prosseguir deste ponto? Desde já agradeço Edu -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.