For Programmers: Free Programming Magazines  


Home > Archive > PHP Installation > July 2004 > locale functions on OpenBSD 3.5









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author locale functions on OpenBSD 3.5
Frank Bax

2004-07-20, 3:57 pm

I've installed binary packages (see below) from OpenBSD 3.5 CDROM. I'm
having trouble with the locale functions (setlocale and localeconv). I
have tried the following code with $sLocale set to '', 'en_US', 'de_DE',
'fr_FR', 'it_IT', 'C' and 'POSIX':
<?php
setlocale(LC_ALL, $sLocale='C);
$aLocaleInfo = localeconv();
foreach($aLocaleInfo as $key=>$val) {
echo "$sLocale.$key=$val<br>\n";
}
?>
All produce the same output:
C.decimal_point=.
C.thousands_sep= (it_IT results in '.')
C.int_curr_symbol=
C.currency_symbol=
C.mon_decimal_point=
C.mon_thousands_sep=
C.positive_sign=
C.negative_sign=
C.int_frac_digits=127
C.frac_digits=127
C.p_cs_precedes=127
C.p_sep_by_space=127
C.n_cs_precedes=127
C.n_sep_by_space=127
C.p_sign_posn=127
C.n_sign_posn=127
C.grouping=Array
C.mon_grouping=Array

After some research I found the setlocale 'C' function on OpenBSD has some
bugs listed:
http://resin.csoft.net/cgi-bin/man....topic=setlocale
BUGS
The current implementation supports only the "C" and "POSIX" locales for
all but the LC_CTYPE locale.

In spite of the gnarly currency support in localeconv(), the standards
don't include any functions for generalized currency formatting.

LC_COLLATE does not make sense for many languages. Use of LC_MONETARY
could lead to misleading results until we have a real time currency con-
version function. LC_NUMERIC and LC_TIME are personal choices and should
not be wrapped up with the other categories.

So I have three questions:
1) Is there a connection between the C and PHP setlocale functions?
2) If PHP setlocale calls the C routine, then why don't PHP manuals
indicate the function is platform/compiler dependant?
3) Are there any values of $sLocale that work on OpenBSD 3.5?

Package list:
gettext-0.10.40p1 GNU gettext
libiconv-1.9.1 character set conversion library
mysql-client-4.0.18 multithreaded SQL database (client)
mysql-server-4.0.18 multithreaded SQL database (server)
ntp-4.1.74 network time protocol implementation
p5-DBD-mysql-2.90.03 MySQL drivers for the Perl DBI
p5-DBI-1.38 unified perl interface for database access
p5-Net-Daemon-0.38 extension for portable daemons
p5-PlRPC-0.2017 module for writing rpc servers and clients
php4-core-4.3.5RC3 server-side HTML-embedded scripting language
php4-mysql-4.3.5RC3 mysql database access extensions for php4
php4-pear-4.3.5RC3 base classes for common PHP tasks
php4-pgsql-4.3.5RC3 pgsql database access extensions for php4
postgresql-7.3.5 PostgreSQL RDBMS
recode-3.6p1 convert files between character sets and usages
rsync-2.5.7 mirroring/synchronization over low bandwidth links
screen-4.0.2 multi-screen window manager
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com