Saturday, February 25, 2012

Problem using Portugueses characters

Dear friends,
I got a XML string that I need to convert in a select statement. I'm using
OPENXML to do it and everything works well, but when I write Portugueses
words in my XML document(for sample: valida'o) is shown something weird
like: valida'o
I tried to change the collation, using SQL_Latin1_General_CP1_CS_AS and so
on, but nothing works. Check out my code.
---
declare @.idoc int
declare @.doc_xml_nota varchar(8000)
set @.doc_xml_nota = '
<?xml version="1.0" encoding="ISO-8859-1"?>
<NewDataSet>
<nota_fiscal_fornecedor_setor_publico>
<des_informacao_complement>valida'o </des_informacao_complement>
</nota_fiscal_fornecedor_setor_publico>
</NewDataSet>
'
EXEC sp_xml_preparedocument @.idoc OUTPUT, @.doc_xml_nota
select *
FROM OPENXML (@.idoc, '/NewDataSet/nota_fiscal_fornecedor_setor_publico', 2)
WITH
(
des_informacao_complement char(225) COLLATE SQL_Latin1_General_CP1_CS_AS
)
EXEC sp_xml_removedocument @.idoc
Thanks,
Euler Almeida
Message posted via http://www.webservertalk.comCan you use Unicode characters instead?
E.g,
declare @.doc_xml_nota nvarchar(8000)
set @.doc_xml_nota = N'<NewDataSet>
<nota_fiscal_fornecedor_setor_publico>
<des_informacao_complement>valida'o </des_informacao_complement>
</nota_fiscal_fornecedor_setor_publico>
</NewDataSet> '
Otherwise, you need to make sure that the database collation and the
encoding inside the XML and the character codes are all aligned...
Best regards
Michael
"Euler Almeida via webservertalk.com" <forum@.webservertalk.com> wrote in message
news:cdc1fae2f9d34240ac26017dcba8b8aa@.SQ
webservertalk.com...
> Dear friends,
> I got a XML string that I need to convert in a select statement. I'm using
> OPENXML to do it and everything works well, but when I write Portugueses
> words in my XML document(for sample: valida'o) is shown something weird
> like: valida'o
> I tried to change the collation, using SQL_Latin1_General_CP1_CS_AS and so
> on, but nothing works. Check out my code.
> ---
> declare @.idoc int
> declare @.doc_xml_nota varchar(8000)
> set @.doc_xml_nota = '
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <NewDataSet>
> <nota_fiscal_fornecedor_setor_publico>
> <des_informacao_complement>valida'o </des_informacao_complement>
> </nota_fiscal_fornecedor_setor_publico>
> </NewDataSet>
> '
> EXEC sp_xml_preparedocument @.idoc OUTPUT, @.doc_xml_nota
> select *
> FROM OPENXML (@.idoc, '/NewDataSet/nota_fiscal_fornecedor_setor_publico',
> 2)
> WITH
> (
> des_informacao_complement char(225) COLLATE SQL_Latin1_General_CP1_CS_AS
> )
> EXEC sp_xml_removedocument @.idoc
>
> Thanks,
> Euler Almeida
> --
> Message posted via http://www.webservertalk.com

No comments:

Post a Comment