icu

How would I use php-intl to convert country codes to localized country names

流过昼夜 提交于 2019-12-08 08:43:02
问题 Hello I need to retrieve full country names based on a country code and a locale in PHP. Since php-intl is now supposed to be able to do this I want to use that. nl_NL nl -> Nederland uk -> Verenigd Koninkrijk en_UK nl -> The Netherlands uk -> United Kindom I think I need to use php-intl resource bundles somehow, but am unable to find any useful examples. 回答1: Exactly. The intl methods can help you with that. You need to use Locale::getDisplayRegion Object oriented style: static string Locale

ICU and string compare

一世执手 提交于 2019-12-08 05:37:39
问题 can anybody explain why the following compare are not equal? void CompareTest() { UErrorCode status = U_ZERO_ERROR; UChar ruleset[500]; *ruleset = 0; int32_t rlen = 0; UCollator *coll = ucol_open("de_DE", &status); static const UChar rules[] = L"&\\u0000 = '' = '-'"; int32_t len=(int32_t)u_strlen(rules); const UChar *defRules = ucol_getRules(coll, &rlen); if(rlen > 0) { u_strcpy(ruleset, defRules); } u_strcat(ruleset, rules); status = U_ZERO_ERROR; UCollator *collRule = ucol_openRules(ruleset

Using only UTF8 encoding in SQLite, what can I trim out of the ICU dataset?

核能气质少年 提交于 2019-12-08 04:09:24
问题 ICU provides a way of cutting down the size of the .dat file. I'm almost certain I don't need most of the encodings that are default. If I want to build a CJK .dat file specifically for sqlite, which ones can I cut out. I just need the tokenizer to work and possibly collation. Seems that all those character conversions may not really be necessary. At 17MB, it is too FAT! For all database, we use PRAGMA encoding = UTF8; Data Customizer Link: http://apps.icu-project.org/datacustom/ To put it

Display ICU UDate formatted for different timezones

若如初见. 提交于 2019-12-08 00:35:04
问题 In the following example, I would like to format EPOCH (1/1/1970) in different time zones. For example, I may wish to format EPOCH using the Los Angeles time zone and/or format EPOCH using the New York timezone . UErrorCode uErrorCode = U_ZERO_ERROR; UnicodeString unicodeString; UDate uDate; icu::Locale locale = icu::Locale("en"); TimeZone* timeZone = TimeZone::createTimeZone("America/Los_Angeles"); Calendar* calendar = Calendar::createInstance(timeZone, uErrorCode); // setting calendar to

Update ICU extension within xampp?

青春壹個敷衍的年華 提交于 2019-12-07 20:44:31
I'm running xampp and I need to upgrade ICU (php_intl extension) to the latest version - I downloaded 54 from the ICU page but unsure how to go about upgrading it. There is a bin , include and lib folder - where do I put these files and do I have to do anything else? To upgrade existing ICU in you XAMP installation you'll need to: copy php_intl.dll to your_xamp_folder/php copy all the icu*.dll files to your_xamp_folder/apache/bin check if extension=php_intl.dll is enabled in your_xamp_folder/php/php.ini restart Apache Let me know if it works (i'm currently on nginx) Edit: you'll find php_intl

ResourceBundle returns NULL without any errors being raised

ⅰ亾dé卋堺 提交于 2019-12-07 08:55:14
问题 For internationalized data it would be great to work with the \ResourceBundle class from PHP's "intl" extension. I got the extension running (PHP 5.3.4; Windows) and created a .dat file using the ICU Data Library Customizer*, but I don't get the expected result from the resource bundle class. Now I do this $bundle = '/var/www/libs/icudt48l.dat'; $resource = new \ResourceBundle('en_US', $bundle, true); var_dump($resource, is_file($bundle)); //--> NULL, TRUE The problem is $resource returns

How to get started with ICU in C

元气小坏坏 提交于 2019-12-06 23:56:17
问题 I need to handle unicode strings in C. I have heard that ICU is the appropriate set of libraries to use but I am not having any luck getting started. So my question: Can anyone provide a link to a good beginners tutorial on using unicode strings with ICU in C P.S. I have installed libicu44 (under Ubuntu 11.04). 回答1: ICU Reference Documentation Tutorial 来源: https://stackoverflow.com/questions/7294447/how-to-get-started-with-icu-in-c

ICU Unicode Normal vs Fullwidth

Deadly 提交于 2019-12-06 09:42:30
I am somewhat new to unicode and unicode strings. I'm trying to determine the difference between "fullwidth" symbol and a normal one. Take these two for example: Normal: http://www.fileformat.info/info/unicode/char/20a9/index.htm Fullwidth: http://www.fileformat.info/info/unicode/char/ffe6/index.htm I notice that the fullwidth is defined as U+20A9 and coincidentally 20A9 is the normal one. So what is the value of U? When using libraries like ICU is there a way to specify always return normal versus full? Thanks, U+number is a notational convention for a Unicode code point. There is no 'value'

icu4c--> ushape.c missing character in shaping?

Deadly 提交于 2019-12-06 09:20:26
in our langauge we use arabic characters in writing with some differences, icu's ushape.c ( arabic shaper) only works with main arabic characters and dosn't shape my language specific characters ( i.e 0x6D5 etc) i'v changed ushape.c to work with my language and it worked well except for on character, that is 0x649, in arabic they have only 2 shapes, in my langauge we have 4 shapes for it. i'v changed line 183 1 + 256 * 0x7F,/*0x0649*/ to 1+2+8 + 256 * 0x98 /*0x649*/ and changed line 121 static const UChar yehHamzaToYeh[] = { /* isolated*/ 0xFEEF, /* final */ 0xFEF0 }; to static const UChar

libicui18n.so.52: cannot open shared object file

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 04:27:24
I have been using libicu to detect charset in my node app that runs inside of docker, ubuntu. this is done through the module node-icu-charset-detector that uses the libicu-dev package, which I install prior to the npm package. It all worked fine but I suddently get the error module.js:356 Module._extensions[extension](this, filename); ^ Error: libicui18n.so.52: cannot open shared object file: No such file or directory at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/app/node