473,396 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

accented characters to unaccented

Is there python library or function to convert accented characters to unaccented. For example

From 'Terme \xc4\x8cate\xc5\xbe' to 'Terme Čatež'.

When I read Terme Čatež website using urllib.urlopen() functio, gives 'Terme \xc4\x8cate\xc5\xbe'
Jun 7 '10 #1
2 2619
Glenton
391 Expert 256MB
This doesn't answer your question, but you could include
Expand|Select|Wrap|Line Numbers
  1. # -*- coding: utf-8 -*-
  2.  
in the first or second line of your code. That should enable it to display the accented characters.

What you're trying to do is possible with the module unicodedata.

Expand|Select|Wrap|Line Numbers
  1. t='\xc5\xbe'
  2. u=t.decode('utf-8')
  3. unicodedata.decomposition(u)
  4.  
returns '007A 030C'. The former is the unicode hex for the letter your looking for. 007A = 122, and unichr(122) = u'z'. Or chr('122') = 'z'.

That should be enough to get you going. I'm afraid I don't use this much, but let us know how you get on.
Jun 8 '10 #2
@Glenton
Hi,

Thanks for your reply. Let me elaborate problem:

I have used urllib module to open and read web site, scripts looks like:
import urllib
txt = urllib.urlopen("http://www.terme-catez.si").read()
txt

gives result like below:
....some more portion is skipped....
Expand|Select|Wrap|Line Numbers
  1. <div class="noga">\r\n    <p>\r\n      Vse gradivo\r\n      &copy; 1999-\
  2. r\n      2010\r\n      <a href="http://www.terme-catez.si" target="_blank">Terme
  3.  \xc4\x8cate\xc5\xbe</a>\r\n      Slovenija\r\n      <br />\r\n      Spletne re\
  4. xc5\xa1itve\r\n      &copy; 1996-\r\n      2010\r\n      <a href="http://www.tme
  5. dia.biz" target="_blank">(T)media</a></p>\r\n  </div>\r\n</div>\r\n<div class="o
If you see above code, accented chars looks like:
Terme \xc4\x8cate\xc5\xbe (original is Terme Čatež).

However, I want Terme Čatež to Terme Catez. So, code like \xc4\x8c or \xc5\xbe should be converted into unaccented chars.

Is there any way to replace all such code to unaccented chars.

Thanks
Jun 8 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Fuzzyman | last post by:
I've written an anagram finder that produces anagrams from a dictionary of words. The user can load their own dictionary. ( http://www.voidspace.org.uk/atlantibots/nanagram.html ) In order to...
2
by: Remco van den Berg | last post by:
I'm running a MySQL database with one of tables holding the members of a volleybal club in the Netherlands. One the the fields in that table is holding the name of the players. How do I search...
10
by: John Byrne | last post by:
I have encountered a problem when certain European characters are included in the Querystring of an URL. If I have a URL like: ?param=AAà On the receiving page a simple Request() call returns...
2
by: nicolas_riesch | last post by:
I try to use python as the language in an asp page with Microsoft IIS 5.0. I have these two files, req_bad.asp and req_ok.asp ---------- req_bad.asp --------- <%@LANGUAGE=Python%> <%
4
by: Satish | last post by:
Hi Gurus, Please help me in this, I have tried all options available to me. (Option 1) I am making a simple request from VB.NET client to WBI generated WSDL and passing request parameters. The...
9
by: JezB | last post by:
Is there anything in the framework which will help translate accented characters in strings to their standard counterparts? eg. "Gráda" to "Grada"
0
by: shintu | last post by:
Hallo, I am trying to write french accented characters é è ê in Excel worksheet using my perl script , But I am stuck here as I couldnt find a way of writing it !: My code: use strict;...
2
by: gsuns82 | last post by:
Hi all, I have to replace accented characters from a input string with normal plain text.I have coded as follows. String input = "ÄÀÁÂÃ"; input=...
4
by: gsuns82 | last post by:
Hi all, I am facing a strange issue. i.e: I have a jsp page with an input text field where the user can enter searching value even along with Accented Characters.After that i...
1
by: gsauns | last post by:
I have an ASP.NET app in which I import from a comma-delimited text file, put all that data in a GridView, and then insert the records into multiple related tables in my SQL Server database. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.