ICU introduction

xiaoxiao2021-03-06  36

Because you want to develop a FrontServer at the trip, you need to convert various types of character sets to standard UTF-8, and then make a string comparison.

Therefore, naturally think of unicodestring in the ICU package, here, use the ICU's experience to do some records.

download

Http://www-124.ibm.com/icu/download/ Download the 3.2 version of the ICU package, there are two versions of Source Code and Binary. Download the latter is more convenient (I can't do ./configure command, you can only make it) ICU-3.2-linuxredhat9-gcc3.2.2.tgz is used for the version of Redhat, after downloading, copy to the root directory, ie #> mv ./icu-3.2.2.2.tgz / #> cd / #> tar xzvf ICU-3.2-LinuxRedhat9-gcc3.2.2.tgz It will automatically decompress the / usr / local / directory, including bin, Include, Lib and other directorys.

Write test procedures

Start the VI editor, enter the following code #include "unistr.h" int main (int Argc, char * argv []) {UnicodeString UI;} Saved as main.cpp Edited Makefile as follows: Main: main.o g -o main Main.o main.o: main.cpp g -c main.cpp Execute Make to report an error, one is not found, and the link cannot be found.

Compile link

Notice that in / usr / local / lib / ICU / directory has such files DRWXR-XR-X 2 Song Song 4096 NOV 18 05:48 3.2 lrwxrwrwx 1 song song 3 jan 18 00:22 Current -> 3.2 lrwxrwrwx 1 Song Song 20 Jan 18 00:22 makefile.inc -> current / makefile.inc's Makefile.inc prompts the method for using the ICU package. That is, Makefile is as follows: include /usr/local/lib/icu/makefile.inc main: main.o g -o main main.o $ (ipflags) $ (iculibs) main.o: main.cpp g -c main. CPP $ (cppflags) / Unicode / You can compile the link.

转载请注明原文地址:https://www.9cbs.com/read-67692.html

New Post(0)