I'm getting some Chinese language data from sql server in some encoded format, maybe unicode?... it starts with an ampersand '&', then there is a '#' pound sign, then a 5 digit integer, then a semi colon. I notice it gets translated when I post it exactly, so I'm trying to descibe it here. If I put some spaces between it, a single character looks like this (remove spaces):
& # 35843 ;
Anyway, THIS is the big problem:
1. In ASP.NET 2.0 web page, if I programmaticall y move the data into an asp:textbox, or an html input textbox, I get the data exactly as it looks in SQL server with the ampersand, pound, number, semicolon format. But I need this to show the Chinese characters.
2. If I move this data into a the innerHtml property of a div tag for example, I see Chinese characters as expected, for example:
articleArea.Inn erHtml = article.NativeH eadline; //this works great!!!
4. Interstingly, if I cut and paste from the DIV in step 2, to the textbox, the textbox shows the Chinese characters just fine... but this does not solve the problem of course, just an interesting note.
5. I did also try changing the font to MS Arial Unicode and that didn't work, also tried changing the encoding in the page directive to UTF-8, no dice
6. Another interesting note, a gridview column will display the data just fine too!
7. Is there some conversion I can do in c# server side to get it to work? I know for example, that IF the data is in this format:
char[] chinese = {'\u6B22','\u8F CE','\u4F7F','\ u7528','\u0020' };
and I move this to the textbox, the data also shows as expected. But how to get the ampersand, pound, number, semicolon format translated to the above?
Anyone fix this problem already?
& # 35843 ;
Anyway, THIS is the big problem:
1. In ASP.NET 2.0 web page, if I programmaticall y move the data into an asp:textbox, or an html input textbox, I get the data exactly as it looks in SQL server with the ampersand, pound, number, semicolon format. But I need this to show the Chinese characters.
2. If I move this data into a the innerHtml property of a div tag for example, I see Chinese characters as expected, for example:
articleArea.Inn erHtml = article.NativeH eadline; //this works great!!!
4. Interstingly, if I cut and paste from the DIV in step 2, to the textbox, the textbox shows the Chinese characters just fine... but this does not solve the problem of course, just an interesting note.
5. I did also try changing the font to MS Arial Unicode and that didn't work, also tried changing the encoding in the page directive to UTF-8, no dice
6. Another interesting note, a gridview column will display the data just fine too!
7. Is there some conversion I can do in c# server side to get it to work? I know for example, that IF the data is in this format:
char[] chinese = {'\u6B22','\u8F CE','\u4F7F','\ u7528','\u0020' };
and I move this to the textbox, the data also shows as expected. But how to get the ampersand, pound, number, semicolon format translated to the above?
Anyone fix this problem already?
Comment