How to convert Unicode string to raw string escaped with HTML Entities

Discussion in 'Python' started by ldng, May 10, 2007.

  1. ldng

    ldng Guest

    Hi,

    I'm looking for a way to convert en unicode string encoded in UTF-8 to
    a raw string escaped with HTML Entities. I can't seem to find an easy
    way to do it.

    Quote from urllib will only work on ascii (which kind of defeat the
    purpose imho) and escape from cgi doesn't seems to do anything with my
    string.

    Any suggestion ?
     
    ldng, May 10, 2007
    #1
    1. Advertising

  2. ldng

    Tim Golden Guest

    Re: How to convert Unicode string to raw string escaped with HTMLEntities

    ldng wrote:
    > Hi,
    >
    > I'm looking for a way to convert en unicode string encoded in UTF-8 to
    > a raw string escaped with HTML Entities. I can't seem to find an easy
    > way to do it.
    >
    > Quote from urllib will only work on ascii (which kind of defeat the
    > purpose imho) and escape from cgi doesn't seems to do anything with my
    > string.


    Probably worth having a look at this:

    http://effbot.org/zone/unicode-convert.htm

    TJG
     
    Tim Golden, May 10, 2007
    #2
    1. Advertising

  3. ldng

    ldng Guest

    ldng, May 10, 2007
    #3
  4. ldng

    Tim Golden Guest

    Re: How to convert Unicode string to raw string escaped with HTMLEntities

    ldng wrote:
    > On 10 mai, 11:03, Tim Golden <> wrote:
    >> Probably worth having a look at this:
    >>
    >> http://effbot.org/zone/unicode-convert.htm

    >
    > Great ! You made my day :)
    >
    > Thanks.


    That's all right, but it's the effbot you
    need to thank. (Hope Fredrik's reading this).

    TJG
     
    Tim Golden, May 10, 2007
    #4
    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:
    825
  2. Steven D'Aprano

    Convert from unicode chars to HTML entities

    Steven D'Aprano, Jan 29, 2007, in forum: Python
    Replies:
    8
    Views:
    687
    Roberto Bonvallet
    Feb 8, 2007
  3. Guest
    Replies:
    2
    Views:
    781
    Guest
    Jun 20, 2007
  4. Just Another Victim of the Ambient Morality

    How do I convert escaped HTML into a string?

    Just Another Victim of the Ambient Morality, Nov 24, 2007, in forum: Python
    Replies:
    6
    Views:
    635
    Bruno Desthuilliers
    Nov 24, 2007
  5. Jim Higson
    Replies:
    3
    Views:
    252
    Eric Amick
    Jul 25, 2004
Loading...

Share This Page