473,804 Members | 2,946 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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 ?

May 10 '07 #1
3 5209
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
May 10 '07 #2
On 10 mai, 11:03, Tim Golden <m...@timgolden .me.ukwrote:
>
Probably worth having a look at this:

http://effbot.org/zone/unicode-convert.htm
Great ! You made my day :-)

Thanks.
May 10 '07 #3
ldng wrote:
On 10 mai, 11:03, Tim Golden <m...@timgolden .me.ukwrote:
>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
May 10 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4341
by: Alexander.Veit | last post by:
Hallo, does anyone know how to convert HTML Entities into UCS2-String (Value). For example: I need to convert Sułowska 43 (value in mysql database) to a unicode string with the specified polish character(s) (Polish is just a example).
8
19863
by: Steven D'Aprano | last post by:
I have a string containing Latin-1 characters: s = u"© and many more..." I want to convert it to HTML entities: result => "&copy; and many more..." Decimal/hex escapes would be acceptable:
2
1941
by: | last post by:
I've written an app to parse an XML RSS feed. Some of the content in that RSS feed has entities properly encoded for XML, e.g.: UW&apos;s Hawes To Enter NBA Draft High school&apos;s &apos;No-shush&apos; to retire My app reads the content using XmlDocument/XmlNodeList and then commits selected pieces to my DB. I want to know the best/easiest/most reliable/most complete way to translate
2
4885
by: neovantage | last post by:
hey geeks, I am using a function which convert unicode to entities. So that i can save values into mysql database into entities. This function really helps me when i display the store entity data into web page n it shows special charactor easily. Here is the function code function charset_decode_utf_8($string) { /* Only do the slow convert if there are 8-bit characters */ /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not...
0
10561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10302
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2976
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.