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 acentuao e
cedilha no 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?
Peo desculpas pelo meu Portugus. 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.
On Wed, Feb 23, 2011 at 1:21 PM, Michael P. [email protected]
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.”
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 Wed, Feb 23, 2011 at 1:21 PM, Michael P. [email protected] 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.
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
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… :-/
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::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
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.