]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | Copyright (C) 2016 and later: Unicode, Inc. and others. |
2 | License & terms of use: http://www.unicode.org/copyright.html#License | |
3 | ||
73c04bcf | 4 | Copyright (c) 2003-2005, International Business Machines Corporation and others. All Rights Reserved. |
b75a7d8f A |
5 | uciter8: Lenient reading of 8-bit Unicode with a UCharIterator |
6 | ||
7 | This sample demonstrates reading | |
8 | 8-bit Unicode text leniently, accepting a mix of UTF-8 and CESU-8 | |
9 | and also accepting single surrogates. | |
10 | UTF-8-style macros are defined as well as a UCharIterator. | |
11 | The macros are incomplete (do not assemble code points from pairs of surrogates) | |
12 | but sufficient for the iterator. | |
13 | ||
14 | If you wish to use the lenient-UTF/CESU-8 UCharIterator in a context outside of | |
15 | this sample, then copy the uit_len8.c file, | |
16 | as well as either the uit_len8.h header or just the prototype that it contains. | |
17 | ||
18 | *** Warning: *** | |
19 | This UCharIterator reads an arbitrary mix of UTF-8 and CESU-8 text. | |
20 | It does not conform to any one Unicode charset specification, | |
21 | and its use may lead to security risks. | |
22 | ||
23 | ||
24 | Files: | |
25 | uciter8.c Main source file in C | |
26 | uit_len8.c Lenient-UTF/CESU-8 UCharIterator implementation | |
27 | uit_len8.h Header file with the prototoype for the lenient-UTF/CESU-8 UCharIterator | |
73c04bcf A |
28 | uciter8.sln Windows MSVC workspace. Double-click this to get started. |
29 | uciter8.vcproj Windows MSVC project file | |
b75a7d8f A |
30 | |
31 | To Build uciter8 on Windows | |
32 | 1. Install and build ICU | |
73c04bcf | 33 | 2. In MSVC, open the workspace file icu\samples\uciter8\uciter8.sln |
b75a7d8f A |
34 | 3. Choose a Debug or Release build. |
35 | 4. Build. | |
36 | ||
37 | To Run on Windows | |
38 | 1. Start a command shell window | |
39 | 2. Add ICU's bin directory to the path, e.g. | |
40 | set PATH=c:\icu\bin;%PATH% | |
41 | (Use the path to where ever ICU is on your system.) | |
42 | 3. cd into the uciter8 directory, e.g. | |
43 | cd c:\icu\source\samples\uciter8\debug | |
44 | 4. Run it | |
45 | uciter8 | |
46 | ||
47 | To Build on Unixes | |
48 | 1. Build ICU. | |
49 | Specify an ICU install directory when running configure, | |
50 | using the --prefix option. The steps to build ICU will look something | |
51 | like this: | |
52 | cd <icu directory>/source | |
53 | runConfigureICU <platform-name> --prefix <icu install directory> [other options] | |
54 | gmake all | |
55 | ||
56 | 2. Install ICU, | |
57 | gmake install | |
58 | ||
59 | 3. Compile | |
60 | cd <icu directory>/source/samples/uciter8 | |
61 | gmake ICU_PREFIX=<icu install directory) | |
62 | ||
63 | To Run on Unixes | |
64 | cd <icu directory>/source/samples/uciter8 | |
65 | ||
66 | gmake ICU_PREFIX=<icu install directory> check | |
67 | -or- | |
68 | ||
69 | export LD_LIBRARY_PATH=<icu install directory>/lib:.:$LD_LIBRARY_PATH | |
70 | uciter8 | |
71 | ||
72 | ||
73 | Note: The name of the LD_LIBRARY_PATH variable is different on some systems. | |
74 | If in doubt, run the sample using "gmake check", and note the name of | |
75 | the variable that is used there. LD_LIBRARY_PATH is the correct name | |
76 | for Linux and Solaris. |