all groups > dotnet xml > september 2005 >
You're in the

dotnet xml

group:

Encoding troubles


Encoding troubles Jeroen De Brabander
9/30/2005 3:34:16 PM
dotnet xml:
Hi,

I have problems with XML Encoding concerning special characters like é and
è.
I have set the processing instruction to UTF-16 and the file is saved as
UTF-16.
The XML is valid and well-formed, this isn't the problem.

I have 2 machines running exactly the same application (code is identical,
running under the same account) for parsing an XML. I gave both applications
the same XML-file.

Result:
The first application reads the é as é : correct
The second application reads the é as ?? : what is the matter here?

The unicode-regional settings are identical on both machines.

What did I miss?

Thx!

Jeroen db

Re: Encoding troubles Martin Honnen
9/30/2005 3:45:25 PM


[quoted text, click to view]


[quoted text, click to view]

If you don't get an XML parse error about invalid characters then let us
assume the file is indeed properly UTF-16 encoded. What kind of
application is that, where/how do you try to output the characters read
from the XML? Is that an ASP.NET application that sends stuff to the
browser, or is it a Windows console application sending stuff to the
console window, or is it a WinForms GUI application displaying the
output in some control?

--

Martin Honnen --- MVP XML
Re: Encoding troubles Jeroen De Brabander
9/30/2005 3:56:59 PM
Hi Martin,

Thx for your quick reply.

There are indeed no parse errors.

It is a webservice on WS2003 that parses the XML and creates SharePoint
websites from it.
The content of the XML is used to define title and description for the
websites.

On my testing machine the special characters are translated correctly, in
the live environment I get question marks.

Kind regards,

Jeroen De Brabander


[quoted text, click to view]

Re: Encoding troubles Martin Honnen
9/30/2005 4:11:57 PM


[quoted text, click to view]


[quoted text, click to view]

I have no knowledge about Sharepoint but if you say web sites then the
ouput problem with the '??' is probably in a browser rendering those web
sites. Assuming the content is served over HTTP then you need to make
sure the output encoding SharePoint creates is transmitted to the
browser/client in a HTTP response header e.g. in ASP you would do
Response.ContentType = "text/html; charset=UTF-8"
for instance where of course the charset needs to be what the server
generates.
I don't think it is an XML problem really, if you can parse the XML
input fine then in your .NET code you should have strings with unicode
characters and the problem occurs later when your application creates
the output and probably then when the client/browser tries to render the
output.


--

Martin Honnen --- MVP XML
Re: Encoding troubles Jeroen De Brabander
9/30/2005 8:45:59 PM



[quoted text, click to view]

Hi Martin,

If what you say is the case, than I can't explain why the rendering in my
test-environment is fine.
The test sharepoint environment is identical to the one in production.

If I watch the XML (the file), it is fine. I select the nodes en use the
string as input for the description/title fields.
In test it is ok, in production I get "??".

I agree with you that the problem probably is not the XML.
The only difference is that they're on a different machine ... Can there be
an influence of regional machine settings?

Thx for your support !

Jeroen db

Re: Encoding troubles Martin Honnen
10/1/2005 12:02:08 PM


[quoted text, click to view]


[quoted text, click to view]

Is the production site online so that you could post a URL where one can
see the problem?
Do you visit those Sharepoint sites with a web browser like MS IE or
Firefox?

If you agree it is not an XML problem then you could try to look for
help in a Sharepoint group or forum. In my understanding you can ignore
the XML, you have a string with certain characters and have problem to
get them rendered properly in a client as far as I understand.


--

Martin Honnen --- MVP XML
Re: Encoding troubles Jeroen De Brabander
10/2/2005 12:00:00 AM
Hi Martin,

Unfortunately I can't give you a URL as it is not a public site. As client
we only use IE.
Strange thing is that when we access both test and production sites from one
single client machine, the testsite shows the correct é-values, the
productionsite shows ??.

So the problem is not:
- the XML-format
- the client

I start thinking that there is a language/regional settings-difference
between the 2 webservices (test/production). The webservice takes the values
from the XML (the XML is fine) and accepts the values in UTF-8 instead of
UTF-16 in case of the production environment. Maybe there is a difference in
configuration of IIS. I'll try to figure it out.

Thanks for the support, Martin !

Kind regards,

Jeroen db



[quoted text, click to view]

AddThis Social Bookmark Button