473,385 Members | 1,838 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,385 software developers and data experts.

Convert on uppercase unaccentent unicode character

JBJ
Hi,
I'am very newbie in Python.
For the moment I'am trying to convert an unicode character to his uppercase
unaccented character.
By example with locale fr_FR:
a,A,à,À should return A
o,O,ô,Ô should return O
½,¼ should return ¼
i,I,î,Î should return I

Have you some suggestions ?

Thank.
Oct 3 '07 #1
12 2570
On Oct 4, 7:35 am, JBJ <Jean-Bernard.jacquet-at-tele-deux-
point...@invalid.orgwrote:
Hi,
I'am very newbie in Python.
For the moment I'am trying to convert an unicode character to his uppercase
unaccented character.
By example with locale fr_FR:
a,A,à,À should return A
o,O,ô,Ô should return O
½,¼ should return ¼
i,I,î,Î should return I

Have you some suggestions ?

Thank.
Unicode strings have an upper() method - try that. I'm think it
should work properly with your locale - it doesn't give the expected
result for me with an english locale.

Oct 3 '07 #2
ti******@gmail.com wrote:
On Oct 4, 7:35 am, JBJ <Jean-Bernard.jacquet-at-tele-deux-
point...@invalid.orgwrote:
>Hi,
I'am very newbie in Python.
For the moment I'am trying to convert an unicode character to his
uppercase unaccented character.
By example with locale fr_FR:
a,A,à,À should return A
o,O,ô,Ô should return O
½,¼ should return ¼
i,I,î,Î should return I

Have you some suggestions ?

Thank.

Unicode strings have an upper() method - try that. I'm think it
should work properly with your locale - it doesn't give the expected
result for me with an english locale.
No, that will uppercase the string, but it doesn't (and shouldn't) strip
the accents:
>>s = u'''By example with locale fr_FR:
a,A,à,À should return A
o,O,ô,Ô should return O
½,¼ should return ¼
i,I,î,Î should return I'''
>>print s.upper()
BY EXAMPLE WITH LOCALE FR_FR:
A,A,À,À SHOULD RETURN A
O,O,Ô,Ô SHOULD RETURN O
½,¼ SHOULD RETURN ¼
I,I,Î,Î SHOULD RETURN I
>>>
I guess maybe my newreader corrupted the third line. It probably corrupts
all the others when I send this.
Oct 3 '07 #3
On Oct 4, 4:35 am, JBJ <Jean-Bernard.jacquet-at-tele-deux-
point...@invalid.orgwrote:
Hi,
I'am very newbie in Python.
For the moment I'am trying to convert an unicode character to his uppercase
unaccented character.
By example with locale fr_FR:
a,A,à,À should return A
o,O,ô,Ô should return O
½,¼ should return ¼
i,I,î,Î should return I

Have you some suggestions ?

Thank.
Google in this newsgroup for a thread started by "bussiere" on or
about 2006-03-25. The code snippet provided by Fredrik Lundh should
help you.
Oct 3 '07 #4
Duncan Booth wrote:
ti******@gmail.com wrote:
>On Oct 4, 7:35 am, JBJ <Jean-Bernard.jacquet-at-tele-deux-
point...@invalid.orgwrote:
>>Hi,
I'am very newbie in Python.
For the moment I'am trying to convert an unicode character to his
uppercase unaccented character.
By example with locale fr_FR:
a,A,à,À should return A
o,O,ô,Ô should return O
½,¼ should return ¼
i,I,î,Î should return I

Have you some suggestions ?

Thank.
Unicode strings have an upper() method - try that. I'm think it
should work properly with your locale - it doesn't give the expected
result for me with an english locale.
No, that will uppercase the string, but it doesn't (and shouldn't) strip
the accents:
I can agree that is doesn't (though I am taking your word for it), but a
French person will definitely feel it's doing the wrong thing. Upper
case letters aren't accented in written French.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline

Oct 3 '07 #5
Steve Holden <st***@holdenweb.comwrote:
>No, that will uppercase the string, but it doesn't (and shouldn't)
strip the accents:
I can agree that is doesn't (though I am taking your word for it), but
a French person will definitely feel it's doing the wrong thing. Upper
case letters aren't accented in written French.
I didn't know that, and I'm not sure I believe it: but then the French
tend to have conventions honoured more in the breach than the observance. I
just hit a few French websites, and the first one that I found which had
any capital letters that might be accented had four accented capital
letters on its front page (two capitalized words and two words in block
capitals).
Oct 3 '07 #6
On Oct 4, 7:06 am, Duncan Booth <duncan.bo...@invalid.invalidwrote:
Steve Holden <st...@holdenweb.comwrote:
No, that will uppercase the string, but it doesn't (and shouldn't)
strip the accents:
I can agree that is doesn't (though I am taking your word for it), but
a French person will definitely feel it's doing the wrong thing. Upper
case letters aren't accented in written French.

I didn't know that, and I'm not sure I believe it: but then the French
tend to have conventions honoured more in the breach than the observance. I
just hit a few French websites, and the first one that I found which had
any capital letters that might be accented had four accented capital
letters on its front page (two capitalized words and two words in block
capitals).
The usual rationale for such treatment of accented characters is for
fuzzy matching:
if upshiftedunaccented(text1) == upshiftedunaccented(text2):
Oct 4 '07 #7
In message <Xn*************************@127.0.0.1>, Duncan Booth wrote:
Steve Holden <st***@holdenweb.comwrote:
>>No, that will uppercase the string, but it doesn't (and shouldn't)
strip the accents:
I can agree that is doesn't (though I am taking your word for it), but
a French person will definitely feel it's doing the wrong thing. Upper
case letters aren't accented in written French.
I didn't know that, and I'm not sure I believe it: but then the French
tend to have conventions honoured more in the breach than the observance.
Second most diabolical spelling system in the world ... after English.
Oct 4 '07 #8
JBJ
Steve Holden wrote:
Duncan Booth wrote:
>ti******@gmail.com wrote:
>>On Oct 4, 7:35 am, JBJ <Jean-Bernard.jacquet-at-tele-deux-
point...@invalid.orgwrote:
Hi,
I'am very newbie in Python.
For the moment I'am trying to convert an unicode character to his
uppercase unaccented character.
By example with locale fr_FR:
a,A,à,À should return A
o,O,ô,Ô should return O
?,? should return ?
i,I,î,Î should return I

Have you some suggestions ?

Thank.
Unicode strings have an upper() method - try that. I'm think it
should work properly with your locale - it doesn't give the expected
result for me with an english locale.
No, that will uppercase the string, but it doesn't (and shouldn't) strip
the accents:
I can agree that is doesn't (though I am taking your word for it), but a
French person will definitely feel it's doing the wrong thing. Upper
case letters aren't accented in written French.

regards
Steve
http://www.academie-francaise.fr/lan...l#accentuation
Regards
Oct 4 '07 #9
JBJ
John Machin wrote:
On Oct 4, 4:35 am, JBJ <Jean-Bernard.jacquet-at-tele-deux-
point...@invalid.orgwrote:
>Hi,
I'am very newbie in Python.
For the moment I'am trying to convert an unicode character to his
uppercase unaccented character.
By example with locale fr_FR:
a,A,à,À should return A
o,O,ô,Ô should return O
?,? should return ?
i,I,î,Î should return I

Have you some suggestions ?

Thank.

Google in this newsgroup for a thread started by "bussiere" on or
about 2006-03-25. The code snippet provided by Fredrik Lundh should
help you.
Thanks
Oct 4 '07 #10
JBJ wrote:
Steve Holden wrote:
>Duncan Booth wrote:
>>ti******@gmail.com wrote:

On Oct 4, 7:35 am, JBJ <Jean-Bernard.jacquet-at-tele-deux-
point...@invalid.orgwrote:
Hi,
I'am very newbie in Python.
For the moment I'am trying to convert an unicode character to his
uppercase unaccented character.
By example with locale fr_FR:
a,A,à,À should return A
o,O,ô,Ô should return O
?,? should return ?
i,I,î,Î should return I
>
Have you some suggestions ?
>
Thank.
Unicode strings have an upper() method - try that. I'm think it
should work properly with your locale - it doesn't give the expected
result for me with an english locale.

No, that will uppercase the string, but it doesn't (and shouldn't) strip
the accents:
I can agree that is doesn't (though I am taking your word for it), but a
French person will definitely feel it's doing the wrong thing. Upper
case letters aren't accented in written French.

regards
Steve
http://www.academie-francaise.fr/lan...l#accentuation
Malheureusement, I see that absence of accented capitals is a modern
phenomenon that is regarded as an impediment to the language mostly
stemming from laziness of individual authors and inadequacy of low-end
typesetting software. I hadn't realised I was so up-to-date ;-)

So I will have to stop propagating this misinformation.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline so I couldn't cat it

Oct 4 '07 #11
Steve Holden wrote:
Malheureusement, I see that absence of accented capitals is a modern
phenomenon that is regarded as an impediment to the language mostly
stemming from laziness of individual authors and inadequacy of low-end
typesetting software. I hadn't realised I was so up-to-date ;-)

So I will have to stop propagating this misinformation.
Thats really weird, because I was taught in school that caps are not to
be accented. In school! Big Brother is an idiot.

I'm equally ammused by the part of JBJ's link where it says that a
missing acccent "fait hésiter sur la prononciation". Yeah, AS IF written
French had anything to do with the way it is pronounced. Not that I
don't like french, mind you. Everywhere outside action movies its pretty
cool.

/W
Oct 4 '07 #12
Wildemar Wildenburger wrote:
Steve Holden wrote:
>Malheureusement, I see that absence of accented capitals is a modern
phenomenon that is regarded as an impediment to the language mostly
stemming from laziness of individual authors and inadequacy of low-end
typesetting software. I hadn't realised I was so up-to-date ;-)

So I will have to stop propagating this misinformation.

Thats really weird, because I was taught in school that caps are not to
be accented. In school! Big Brother is an idiot.

I'm equally ammused by the part of JBJ's link where it says that a
missing acccent "fait hésiter sur la prononciation". Yeah, AS IF written
French had anything to do with the way it is pronounced. Not that I
don't like french, mind you. Everywhere outside action movies its pretty
cool.

/W
Then you never saw Taxi. Or some of Depardieu's ones. Or Les
adventuriers (sp?) (that's a reeeeally old one), or I comme Icarus....
Oct 5 '07 #13

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

Similar topics

23
by: Hallvard B Furuseth | last post by:
Has someone got a Python routine or module which converts Unicode strings to lowercase (or uppercase)? What I actually need to do is to compare a number of strings in a case-insensitive manner,...
30
by: rh0dium | last post by:
Hi All, While I know there is a zillion ways to do this.. What is the most efficient ( in terms of lines of code ) do simply do this. a=1, b=2, c=3 ... z=26 Now if we really want some...
30
by: John Carroll | last post by:
Does anyone have a function or procedure for converting integers to character strings? Thank you, John
8
by: davihigh | last post by:
My Friends: I am using std::ofstream (as well as ifstream), I hope that when i wrote in some std::string(...) with locale, ofstream can convert to UTF-8 encoding and save file to disk. So does...
8
by: csanjith | last post by:
Hi, i have a situaion where i need to convert the characters entered in an text field to upper case using C. The configuration id utf8 environment in which user can enter any character (single ,...
3
by: GM | last post by:
Dear all, Could you all give me some guide on how to convert my big5 string to unicode using python? I already knew that I might use cjkcodecs or python 2.4 but I still don't have idea on what...
0
by: deloford | last post by:
Hi This is going to be a question for anyone who is an expert in C# Text Encoding. My situation is this: I have a Sybase database which is firing back ISO-8559 encoded strings. I am unable to...
0
by: M.-A. Lemburg | last post by:
On 2008-07-01 20:31, Peter Bulychev wrote: You could write a codec which translates Unicode into a ASCII lookalike characters, but AFAIK there is no standard for doing this. I guess the best...
19
by: est | last post by:
From python manual str( ) Return a string containing a nicely printable representation of an object. For strings, this returns the string itself. The difference with repr(object) is that...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.