Why are these caracters not being display correct

Discussion in 'ASP .Net' started by =?Utf-8?B?Sm9u?=, Aug 25, 2006.

  1. Hello all,

    In my code im using Response.Write(someText) to write out some Japanese text
    to a new browser window. In the command window, the text is correct, but when
    the browser window opens it appears as ャーã®エア抜ãÂÂ.

    Why would this be so? My code is below:

    Response.ClearHeaders();
    Response.ClearContent();
    Response.Buffer= true;
    Response.AppendHeader("content-length", strResponse.Length.ToString());
    Response.AppendHeader("content-disposition", "attachment;filename=Online
    Form Results " + IDToDisplay.ToString()+ ".html");

    Response.ContentType = "text/html";
    Response.ContentEncoding = System.Text.Encoding.UTF8;
    Response.Expires = 0;
    Response.Write(strResponse);

    Response.End();

    Thanks all for help.

    JY
    =?Utf-8?B?Sm9u?=, Aug 25, 2006
    #1
    1. Advertising

  2. You may not be able to cant display Japanese textbwith UTF-8 encoding.
    you'll need to use a japanese charset such as

    <meta http-equiv="content-type" content="text/html; charset=Shift_JIS">

    http://msdn2.microsoft.com/en-us/library/system.text.encoding.codepage.aspx

    I've never tried it but it may be
    Response.ContentEncoding = Encoding.GetEncoding("SHIFT-JIS")

    Regards

    John Timney (MVP)


    "Jon" <> wrote in message
    news:...
    > Hello all,
    >
    > In my code im using Response.Write(someText) to write out some Japanese
    > text
    > to a new browser window. In the command window, the text is correct, but
    > when
    > the browser window opens it appears as ãf£ãf¼ã®ã,¨ã,¢æSoã.
    >
    > Why would this be so? My code is below:
    >
    > Response.ClearHeaders();
    > Response.ClearContent();
    > Response.Buffer= true;
    > Response.AppendHeader("content-length", strResponse.Length.ToString());
    > Response.AppendHeader("content-disposition", "attachment;filename=Online
    > Form Results " + IDToDisplay.ToString()+ ".html");
    >
    > Response.ContentType = "text/html";
    > Response.ContentEncoding = System.Text.Encoding.UTF8;
    > Response.Expires = 0;
    > Response.Write(strResponse);
    >
    > Response.End();
    >
    > Thanks all for help.
    >
    > JY
    John Timney \(MVP\), Aug 25, 2006
    #2
    1. Advertising

  3. =?Utf-8?B?Sm9u?=

    Joerg Jooss Guest

    Thus wrote John,

    > You may not be able to cant display Japanese textbwith UTF-8 encoding.
    > you'll need to use a japanese charset such as
    >
    > <meta http-equiv="content-type" content="text/html;
    > charset=Shift_JIS">
    >
    > http://msdn2.microsoft.com/en-us/library/system.text.encoding.codepage
    > .aspx
    >
    > I've never tried it but it may be
    > Response.ContentEncoding = Encoding.GetEncoding("SHIFT-JIS")
    > Regards


    UTF-8 is a *Unicode* Tranformation Format and thus has no problems encoding
    Japanese characters.

    Cheers,
    --
    Joerg Jooss
    Joerg Jooss, Aug 25, 2006
    #3
  4. =?Utf-8?B?Sm9u?=

    Joerg Jooss Guest

    Thus wrote Jon,

    > Hello all,
    >
    > In my code im using Response.Write(someText) to write out some
    > Japanese text to a new browser window. In the command window, the text
    > is correct, but when the browser window opens it appears as
    > ャーã®ã‚¨ã‚¢æŠœã.
    >
    > Why would this be so? My code is below:
    >
    > Response.ClearHeaders();
    > Response.ClearContent();
    > Response.Buffer= true;
    > Response.AppendHeader("content-length",
    > strResponse.Length.ToString());


    That's not the true Content-Length. Its value may be greater than the string
    length.

    > Response.AppendHeader("content-disposition",
    > "attachment;filename=Online
    > Form Results " + IDToDisplay.ToString()+ ".html");
    > Response.ContentType = "text/html";
    > Response.ContentEncoding = System.Text.Encoding.UTF8;


    Did you check whether the browser did pick up the correct encoding (UTF-8)
    from the HTTP response?

    Cheers,
    --
    Joerg Jooss
    Joerg Jooss, Aug 25, 2006
    #4
  5. I never knew that Joerg. Thanks for correcting me.

    Regards

    John Timney (MVP)


    "Joerg Jooss" <> wrote in message
    news:...
    > Thus wrote John,
    >
    >> You may not be able to cant display Japanese textbwith UTF-8 encoding.
    >> you'll need to use a japanese charset such as
    >>
    >> <meta http-equiv="content-type" content="text/html;
    >> charset=Shift_JIS">
    >>
    >> http://msdn2.microsoft.com/en-us/library/system.text.encoding.codepage
    >> .aspx
    >>
    >> I've never tried it but it may be
    >> Response.ContentEncoding = Encoding.GetEncoding("SHIFT-JIS")
    >> Regards

    >
    > UTF-8 is a *Unicode* Tranformation Format and thus has no problems
    > encoding Japanese characters.
    > Cheers,
    > --
    > Joerg Jooss
    >
    >
    >
    John Timney \(MVP\), Aug 25, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    4,607
    Alain Hogue
    Jan 9, 2006
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,690
    Smokey Grindel
    Dec 2, 2006
  3. Replies:
    4
    Views:
    765
    Tim Greer
    Dec 1, 2008
  4. luca72

    string caracters:

    luca72, Apr 22, 2010, in forum: Python
    Replies:
    2
    Views:
    280
    Bruno Desthuilliers
    Apr 22, 2010
  5. Gir

    Special caracters

    Gir, Jul 27, 2004, in forum: ASP .Net Mobile
    Replies:
    2
    Views:
    213
    Guest
    Jul 27, 2004
Loading...

Share This Page