• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Copyright (C) 2016 and later: Unicode, Inc. and others.
2License & terms of use: http://www.unicode.org/copyright.html#License
3
4Copyright (c) 2003-2005, International Business Machines Corporation and others. All Rights Reserved.
5uciter8: Lenient reading of 8-bit Unicode with a UCharIterator
6
7This sample demonstrates reading
88-bit Unicode text leniently, accepting a mix of UTF-8 and CESU-8
9and also accepting single surrogates.
10UTF-8-style macros are defined as well as a UCharIterator.
11The macros are incomplete (do not assemble code points from pairs of surrogates)
12but sufficient for the iterator.
13
14If you wish to use the lenient-UTF/CESU-8 UCharIterator in a context outside of
15this sample, then copy the uit_len8.c file,
16as well as either the uit_len8.h header or just the prototype that it contains.
17
18*** Warning: ***
19This UCharIterator reads an arbitrary mix of UTF-8 and CESU-8 text.
20It does not conform to any one Unicode charset specification,
21and its use may lead to security risks.
22
23
24Files:
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
28    uciter8.sln      Windows MSVC workspace.  Double-click this to get started.
29    uciter8.vcproj   Windows MSVC project file
30
31To Build uciter8 on Windows
32    1.  Install and build ICU
33    2.  In MSVC, open the workspace file icu\samples\uciter8\uciter8.sln
34    3.  Choose a Debug or Release build.
35    4.  Build.
36
37To 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
47To 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
63To 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.
77