aspx display romanian diacritics

G

george.miscalencu

I'm trying to display a text from a database, text that contains
Romanian diacritics (aîst) in a aspx page. The text has been
inserted in the database using a asp application with a HTML editor
with this setting: content-type="text/html; charset=iso-8859-2"

I have failed to do this. I've tried using all the possible settings
that I know: setting content-type or charset in web.config ->
globalization, from IIS -> HTTP Headers, from @page
responseEncoding=".., from C# code, using Response.ContentType or
Response.AddHeader or <META> using only one setting at a time or even
combining 2-3 settings..


The only combination that did worked, it was: setting <globalization
responseEncoding="unicode"> and in the same time, in IIS-HTTP Headers:
content-type: ="text/html; charset=iso-8859-2".
The problem is, that in this case, although the text is displayed
correctly (with diacritics) when I try to view the Page Source the text

has a space between every character, and a new empty line between every

two lines. Another problem would be that I would like to change this
settings dynamically, to match my text encoding (I want to use the same

page for different languages) In this case, the setting from the IIS ->

HTTP Headers would not help.


I have even tried to create a empty aspx page with some text with
diacritics from my keyboard, not from the database, but I failed to
display them correctly also.


Can anyone help? Thanks
 
J

Joerg Jooss

Thus wrote george,
I'm trying to display a text from a database, text that contains
Romanian diacritics (aîst) in a aspx page. The text has been inserted
in the database using a asp application with a HTML editor with this
setting: content-type="text/html; charset=iso-8859-2"

Is that the real encoding used by the ASP application? The Meta tag will
be ignored if the HTTP Content-Type header has a charset attribute.
I have failed to do this. I've tried using all the possible settings
that I know: setting content-type or charset in web.config ->
globalization, from IIS -> HTTP Headers, from @page
responseEncoding=".., from C# code, using Response.ContentType or
Response.AddHeader or <META> using only one setting at a time or even
combining 2-3 settings..

The only combination that did worked, it was: setting <globalization
responseEncoding="unicode"> and in the same time, in IIS-HTTP Headers:
content-type: ="text/html; charset=iso-8859-2".
The problem is, that in this case, although the text is displayed
correctly (with diacritics) when I try to view the Page Source the
text
has a space between every character, and a new empty line between
every

Neither IE nor Firefox handle UTF-16 correctly in source view. The first
byte of each two byte sequence is 0x00 and usually displayed as blank, whereas
the second byte matches the characters' code for 8 bit ISO Latin and is displayed
correctly.
two lines. Another problem would be that I would like to change this
settings dynamically, to match my text encoding (I want to use the
same

page for different languages) In this case, the setting from the IIS
->

HTTP Headers would not help.

8 bit encodings like ISO Latin 1, 2, ..., 15 won't work for arbitrary languages/cultures.
You need Unicode.
I have even tried to create a empty aspx page with some text with
diacritics from my keyboard, not from the database, but I failed to
display them correctly also.

You need make sure that the original ASP web page and your ASP.NET application
use the same encoding.

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top