473,804 Members | 3,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bogus locales on Mac

I have been tearing my hair out trying to get Python to sort strings
containing accented characters according to the French locale settings
on Mac OS X (10.3).

I think I've done it correctly because on a Linux box it works...

What I find in the Mac's entrails is this:
/usr/share/locale/fr_FR.UTF-8 contains
LC_COLLATE -> ../la_LN.UTF-8/LC_COLLATE
LC_CTYPE -> ../la_LN.UTF-8/LC_CTYPE
LC_TIME
....

I checked some other locale directories and found the same link to
la_LN.UTF-8/LC_COLLATE, so whatever language you think you are
choosing, you are actually getting the same thing... I don't know what
la_LN is, maybe LATIN... The LC_COLLATE file in /la_LN.UTF-8 is 4642
bytes, the equivalent Linux file is 882134 bytes...

The date strings for the months are really in French in LC_TIME, and
using it does work correctly.

I tried using the Linux LC_COLLATE file on the Mac but it didn't work.

Has anyone using a Mac managed to sort accented strings correctly?

The Mac has mostly tried to be quite international so I'm surprised at
this. Have I missed something?

Thanks.

Ellen

--
-------------------------------------------------------------------
xl**@xlii.suppr imer.org | Ellen C. Herzfeld
http://www.quarante-deux.org/ | Dominique O. Martel
Quelques pages sur la Science-Fiction | Quarante-Deux
-------------------------------------------------------------------
Jul 18 '05 #1
3 1747
Ellen Herzfeld <xl**@xlii.supp rimer.org> writes:

[snip]
Has anyone using a Mac managed to sort accented strings correctly?

The Mac has mostly tried to be quite international so I'm surprised at
this. Have I missed something?


I suspect using some other method than the C libraries locale
functions is necessary... something like CFStringCompare ? Dunno if
Python wraps that, though. Or maybe use PyObjC and NSSting's
-compare:options :range:locale: method.

HTH,
mwh

--
<dash> wow. this code does something highly entertaining, but
nowhere near correct -- from Twisted.Quotes
Jul 18 '05 #2
In article <m3************ @pc150.maths.br is.ac.uk>, Michael Hudson
<mw*@python.net > wrote:
I suspect using some other method than the C libraries locale
functions is necessary... something like CFStringCompare ? Dunno if
Python wraps that, though. Or maybe use PyObjC and NSSting's
-compare:options :range:locale: method.


I suppose there must be some way around the problem using Mac specific
code, but I need my scripts to be portable with minimum hassle. They
may have to run on a Linux or FreeBSD server...

I would like confirmation that I'm not missing something. Why would
Apple not use the standard C files for locales?

Ellen

--
-------------------------------------------------------------------
xl**@xlii.suppr imer.org | Ellen C. Herzfeld
http://www.quarante-deux.org/ | Dominique O. Martel
Quelques pages sur la Science-Fiction | Quarante-Deux
-------------------------------------------------------------------
Jul 18 '05 #3
In article <15************ *********@xlii. supprimer.org>, Ellen Herzfeld
<xl**@xlii.supp rimer.org> wrote:
I suppose there must be some way around the problem using Mac specific
code, but I need my scripts to be portable with minimum hassle. They
may have to run on a Linux or FreeBSD server...

I would like confirmation that I'm not missing something. Why would
Apple not use the standard C files for locales?

Update:
The problem seems to be with the FreeBSD librairies for locales and not
with Apple. The sort problem is identical on FreeBSD 5.2.1. On Linux
(Mandrake) sorting is correct...

Ellen

--
-------------------------------------------------------------------
xl**@xlii.suppr imer.org | Ellen C. Herzfeld
http://www.quarante-deux.org/ | Dominique O. Martel
Quelques pages sur la Science-Fiction | Quarante-Deux
-------------------------------------------------------------------
Jul 18 '05 #4

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

Similar topics

2
1775
by: Luke | last post by:
Hi, I'm getting an OverflowError which doesn't make sense to me. Is this a python bug? Traceback (most recent call last): File "/home/demoau/lib/py/omniORB/__init__.py", line 717, in static_is_a for b in cls.__bases__: OverflowError: long int too large to convert to int
2
1757
by: garykpdx | last post by:
Is there some sort of tutorial on locales or the locale module? I can't seem to find a list showing all possible locales. I made 'en' work alright, but when I tried 'de' or 'de_DE' or 'es_ES', etc. it said that those were not valid locaes. Worst of all, when I tried 'es' it said that this was estonian?! Obviously, this is not what ISO 639 says. 'es' should be Spanish, and Estonian should be 'et. Anyway, I'd love to have a method called...
7
3084
by: saroj.yadav | last post by:
As I understand it (correct me, if I am wrong) Unicode came into picture so that a document containing multiple language characters can be supported like somebody can write a document comparing Korean and Chinese in French language. Now, I am looking at all UNIX platforms and seems like all Unix (AIX, HP, Solaris) platforms support Unicode by supporting language/region specific UTF-8 locales like fr_FR.UTF-8, ja_JP.UTF-8, ko_KR.UTF-8...
3
2791
by: J Trauntvein | last post by:
I was working with a co-worker the other day to work through the process of formatting numeric values by imbueing C++ iostreams with locales. His program's initialisation code had a call to setlocale("",LC_ALL) which I believe sets up locale information for the C run time library but is not supposed to effect the C++ run time. What we found, however, was that, with this function call in place, the C++ iostreams were formatting floating...
3
1538
by: Joshua Stewart | last post by:
Hi, I am trying to characterise a problem I am seeing on our C#/C++ xml driven application. We have recently added some basic Spanish language support to our application, but it seems that there is an issue with certain locale settings. Under Regional and Language Options -Standards and Formats I would normally change the applications language by selecting Spanish (Mexico). It looks like the application ignores the Location field.
8
4712
by: Rik | last post by:
Hi all, is there a in PHP to get the available locales without shellacces (i.e. locale -a)? Grtz, -- Rik Wasmus
2
1881
by: Adrian | last post by:
Hi All, Is there anyway to change what isspace thinks is a space character. I am parsing some log files and it would be nice to just read a field as what ever is between quotes or between 's ie clf log files I know I can go char by char or find_last_of etc, but I would like to know if it is possible with locales and facets? Also are there any suggestions for outputting in multiple languages? Can I use locales again? I was just...
4
1425
by: suresh | last post by:
Hi, I am getting zero as value for some keys in my map which can never happen as per my understanding of my code. These are the details: I have defined an array of vectors, where each vector element is a map, like this: vector<map<string,intentry>* fulldata ;
4
1806
by: Gilles Ganault | last post by:
Hello What does it take to support locales? The following test code found on the PHP site doesn't work as planned: ======= setlocale(LC_TIME, "C"); echo strftime("%A"); setlocale(LC_TIME, "fi_FI"); echo strftime(" in Finnish is %A,");
0
9708
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9587
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10324
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
9161
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
5527
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
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
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
3
2998
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.