Name Date Size #Lines LOC

..--

answers/H25-Apr-2025-513305

MakefileH A D25-Apr-2025630 264

README.TXTH A D25-Apr-20253.8 KiB11277

main.cppH A D25-Apr-20253.9 KiB12984

unaccent.cppH A D25-Apr-20251.7 KiB6132

unaccent.hH A D25-Apr-20252.9 KiB9620

util.cppH A D25-Apr-20252.2 KiB7046

util.hH A D25-Apr-2025872 235

README.TXT

1Copyright (C) 2016 and later: Unicode, Inc. and others.
2License & terms of use: http://www.unicode.org/copyright.html
3
4Copyright (c) 2002-2010, International Business Machines Corporation and others. All Rights Reserved.
5
6
7IMPORTANT:
8
9This sample was originally intended as an exercise for the ICU Workshop (September 2000).
10The code currently provided in the solution file is the answer to the exercises, each step can still be found in the 'answers' subdirectory.
11
12
13
14  http://www.icu-project.org/docs/workshop_2000/agenda.html
15
16  Day 2: September 12th 2000
17  Pre-requisite:
18  1. All the hardware and software requirements from Day 1.
19  2. Attended or fully understand Day 1 material.
20  3. Read through the ICU user's guide at https://unicode-org.github.io/icu/userguide/.
21
22  #Transformation Support
23  10:45am - 12:00pm
24  Alan Liu
25
26  Topics:
27  1. What is the Unicode normalization?
28  2. What kind of case mapping support is available in ICU?
29  3. What is Transliteration and how do I use a Transliterator on a document?
30  4. How do I add my own Transliterator?
31
32
33INSTRUCTIONS
34------------
35
36This exercise was developed and tested on ICU release 1.6.0, Win32,
37Microsoft Visual C++ 6.0.  It should work on other ICU releases and
38other platforms as well.
39
40 MSVC:
41   Open the file "translit.sln" in Microsoft Visual C++.
42
43 Unix:
44   - Build and install ICU with a prefix, for example '--prefix=/home/srl/ICU'
45   - Set the variable  ICU_PREFIX=/home/srl/ICU and use GNU make in
46        this directory.
47   - You may use 'make check' to invoke this sample.
48
49
50PROBLEMS
51--------
52
53Problem 0:
54
55  To start with, the program prints out a series of dates formatted in
56  Greek.  Set up the program, build it, and run it.
57
58Problem 1: Basic Transliterator (Easy)
59
60  The Greek text shows up almost entirely as Unicode escapes.  These
61  are unreadable on a US machine.  Use an existing system
62  transliterator to transliterate the Greek text to Latin so it can be
63  phonetically read on a US machine.  If you don't know the names of
64  the system transliterators, use Transliterator::getAvailableID() and
65  Transliterator::countAvailableIDs(), or look directly in the index
66  table icu/data/translit_index.txt.
67
68Problem 2: RuleBasedTransliterator (Medium)
69
70  Some of the text is still unreadable and shows up as Unicode escape
71  sequences.  Create a RuleBasedTransliterator to change the
72  unreadable characters to close ASCII equivalents.  For example, the
73  rule "\u00C0 > A;" will change an 'A' with a grave accent to a plain
74  'A'.
75
76  To save typing, use UnicodeSets to handle ranges of characters.
77
78  See the included file "U0080.pdf" for a table of the U+00C0 to U+00FF
79  Unicode block.
80
81Problem 3: Transliterator subclassing; Normalizer (Difficult)
82
83  The rule-based approach is flexible and, in most cases, the best
84  choice for creating a new transliterator.  Sometimes, however, a
85  more elegant algorithmic solution is available.  Instead of typing
86  in a list of rules, you can write C++ code to accomplish the desired
87  transliteration.
88
89  Use a Normalizer to remove accents from characters.  You will need
90  to convert each character to a sequence of base and combining
91  characters by applying a canonical denormalization transformation.
92  Then discard the combining characters (the accents etc.) leaving the
93  base character.  Wrap this all up in a subclass of the
94  Transliterator class that overrides the pure virtual
95  handleTransliterate() method.
96
97
98ANSWERS
99-------
100
101The exercise includes answers.  These are in the "answers" directory,
102and are numbered 1, 2, etc.  In some cases new files that the user
103needs to create are included in the answers directory.
104
105If you get stuck and you want to move to the next step, copy the
106answers file into the main directory in order to proceed.  E.g.,
107"main_1.cpp" contains the original "main.cpp" file.  "main_2.cpp"
108contains the "main.cpp" file after problem 1.  Etc.
109
110
111Have fun!
112