Re: Chinese character display problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: User (User_at_aol.com)
Date: 12/18/04


Date: Fri, 17 Dec 2004 16:23:55 -0800

SQL nvarchar can indeed store unicode data.
However the encoding used is UCS-2, like Windows NT/2K - two bytes per char.
ASP and browsers like UTF-8, from 1 to 3 bytes per char.

Try putting the directive <@ CodePage=65001 %> at the top of your ASP page.
This instructs IIS to convert strings from UCS-2 to UTF-8.

You may also want to put in the header:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Of course you must also have Chinese font installed.

"David Gugick" <davidg-nospam@imceda.com> wrote in message
news:#p#7qV$4EHA.3828@TK2MSFTNGP09.phx.gbl...
> manisha_css wrote:
> > I am storing some field in chinese. (field type is nvarchar). When i
> > store it i can not see as chinese character but as some sort of
> > unicode characters. (unreadable)
> >
> > When i try to pick it up from database and display in asp page - i
> > get it but same unicode format (unreadabel)
> >
> > Now whether i need to change any database settings (instead of
> > nvarchar use something else ?) OR do i need to install any font ? OR
> > change browser setting ?
> >
> > What's wrong ?
> >
> > regards
> > Manisha
>
> You are using a unicode character column, so I don't think SQL Server is
> the problem. You are either storing incorrect characters or do not have
> your display set to display Chinese. Check the View | Encoding | More
> menu section in IE if that's what you are using. Also, you should be
> able to use HTML to tell IE the page is going to diaply the language you
> need.
>
> --
> David Gugick
> Imceda Software
> www.imceda.com
>



Relevant Pages

  • Basic UTF-8 support for sh(1)
    ... Here is a patch that adds basic UTF-8 support to sh. ... locales with question marks. ... static struct strlist *msort(struct strlist *, int); ... static char *cvtnum; ...
    (freebsd-hackers)
  • Re: Random thoughts about UTF-8 string literals in N1494
    ... valid UTF-8 would have to be made illegal. ... Part of the problem is that there is no such thing as a UTF-8 character constant. ... I'd say UTF-8 should produce a signed char with a value from 0 ... representation as an unsigned char with that value so that memcpy from ...
    (comp.std.c)
  • Re: UTF-8 in char*
    ... >I am developing a vCard application which have to support UTF-8. ... >treat as NULL character in strlen? ... of type "unsigned char", as those will have at least 8 bits. ... strlensimply operates on an array ...
    (comp.lang.c)
  • Re: Is char obsolete?
    ... representation, e.g. an ASCII string or UTF-8 string or whatever, ... For UTF-8, that is only true for code that pokes about in the ... encoded strings as char arrays. ...
    (comp.lang.c)
  • Re: Unicode version of main in Unix
    ... Henry> 'char', making sure to do UTF-8 conversions where needed. ... Henry> the Unix side. ...
    (comp.unix.programmer)