Server.HtmlDecode("‘") does not work

Discussion in 'ASP .Net' started by emailmygroup, Sep 17, 2007.

  1. emailmygroup

    emailmygroup Guest

    I am trying to decode character &#145#; but it is not working. Anybody
    knows how to decode this character?
     
    emailmygroup, Sep 17, 2007
    #1
    1. Advertisements

  2. What to you mean by decode. It's not coded.

    ‘ is an UTF-8 representation of the symbol.
    You can use Decoder utf8Decoder = Encoding.UTF8.GetDecoder();
    to work with it or convert to Unicode. But you will not fit it into ASCII
    table.


    George.
     
    George Ter-Saakov, Sep 17, 2007
    #2
    1. Advertisements

  3. emailmygroup

    bruce barker Guest

    what do mean by not working? it will creates a 1 char string with an
    ascii value of 145 (which is unprintable)


    -- bruce (sqlwork.com)
     
    bruce barker, Sep 17, 2007
    #3
  4. emailmygroup

    emailmygroup Guest

    From URL
    http://www.eggheadcafe.com/tutorial...74-9130-3210625e675c/html-entities-class.aspx

    I can say that ‘ is a printable character quote. Here is my
    program and its output

    Asc(Server.HtmlDecode("’")) ' Output = 63 = "?"
    Asc(Server.HtmlDecode("G")) ' Output = 71 = "G"
    Asc(Server.HtmlDecode("“")) 'Output = 63 ="?"

    146 represents single quote and 147 represents double quote. so my
    question is am I missing anything?
     
    emailmygroup, Sep 17, 2007
    #4
  5. re:
    !> 146 represents single quote and 147 represents double quote. so my
    !> question is am I missing anything?

    Yes, you are missing 145...

    What does Asc(Server.HtmlDecode("‘")) return ?
     
    Juan T. Llibre, Sep 17, 2007
    #5
  6. emailmygroup

    emailmygroup Guest

    Asc(Server.HtmlDecode("‘")) ' Output = 63 = "?"
     
    emailmygroup, Sep 17, 2007
    #6
  7. emailmygroup

    emailmygroup Guest

    can anybody help me???
     
    emailmygroup, Sep 18, 2007
    #7
  8. I *reaally* don't understand your question.

    When I process Server.HTMLDecode("‘")

    ....what I get as a result is : '

    See the sample at : http://asp.net.do/test/HTMLencode.aspx

    It's the LAST label in the list, after %3f ...and the code is :

    im txtenc2 as String = Server.HTMLDecode("‘")
    lblMessage6.Text = txtenc2

    It seems to render OK in that test. What is the problem you're seeing ?
     
    Juan T. Llibre, Sep 18, 2007
    #8
  9. emailmygroup

    emailmygroup Guest

    When I write Server.HTMLDecode("‘") output is as follows

    Output: (not printable character so no output)
    length of string: 1
    Ascii value of character using Asc function: 63

    Do I need to change any settings anywhere? In my web.config file

    <globalization requestEncoding="utf-8" responseEncoding="utf-8" />

    Thanks
     
    emailmygroup, Sep 18, 2007
    #9
  10. It's not working, because ‘ is not a valid html entity.

    According to all these sources, there is no html entity for character
    codes from 127 through 159:

    http://www.ascii.cl/htmlcodes.htm
    http://www.w3.org/MarkUp/html-spec/html-spec_13.html
    http://www.w3.org/TR/html4/sgml/entities.html

    You can use these htlm entities for quotes:

    &lsquo; ‘ left single quote
    &rsquo; ’ right single quote
    &sbquo; ‚ single low-9 quote
    &ldquo; “ left double quote
    &rdquo; ” right double quote
    &bdquo; „ double low-9 quote

    according to:
    http://www.webmonkey.com/reference/special_characters/
     
    =?windows-1252?Q?G=F6ran_Andersson?=, Sep 18, 2007
    #10
  11. re:
    !> Do I need to change any settings anywhere? In my web.config file
    !> <globalization requestEncoding="utf-8" responseEncoding="utf-8" />

    I'm using :

    <globalization requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" fileEncoding="iso-8859-1" />

    Can you test with those settings...and post back the result ?




    When I write Server.HTMLDecode("‘") output is as follows

    Output: (not printable character so no output)
    length of string: 1
    Ascii value of character using Asc function: 63

    Do I need to change any settings anywhere? In my web.config file

    <globalization requestEncoding="utf-8" responseEncoding="utf-8" />

    Thanks
     
    Juan T. Llibre, Sep 18, 2007
    #11
  12. re:
    !> It's not working, because ‘ is not a valid html entity.

    Goran, can you explain why the sample at :
    http://asp.net.do/test/HTMLencode.aspx works if ("‘") isn't valid ?

    Why would Server.HTMLDecode("‘") be translated to " ' " ?
     
    Juan T. Llibre, Sep 18, 2007
    #12
  13. emailmygroup

    emailmygroup Guest

    I changed web.config as following

    <globalization requestEncoding="iso-8859-1"
    responseEncoding="iso-8859-1" fileEncoding="iso-8859-1" />


    but no luck.
     
    emailmygroup, Sep 19, 2007
    #13
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.