xref: /AOO41X/main/sal/textenc/tcvtbyte.c (revision 647f063d49501903f1667b75f5634541fc603283)
1*647f063dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*647f063dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*647f063dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*647f063dSAndrew Rist  * distributed with this work for additional information
6*647f063dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*647f063dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*647f063dSAndrew Rist  * "License"); you may not use this file except in compliance
9*647f063dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*647f063dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*647f063dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*647f063dSAndrew Rist  * software distributed under the License is distributed on an
15*647f063dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*647f063dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*647f063dSAndrew Rist  * specific language governing permissions and limitations
18*647f063dSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*647f063dSAndrew Rist  *************************************************************/
21*647f063dSAndrew Rist 
22*647f063dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "tenchelp.h"
25cdf0e10cSrcweir #include "rtl/textcvt.h"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir /* ======================================================================= */
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #define IMPL_MAX_REPLACECHAR 5
30cdf0e10cSrcweir 
31cdf0e10cSrcweir sal_uInt16 ImplGetReplaceChar(sal_Unicode c);
32cdf0e10cSrcweir 
33cdf0e10cSrcweir sal_uInt16 const * ImplGetReplaceString(sal_Unicode c);
34cdf0e10cSrcweir 
35cdf0e10cSrcweir /* ----------------------------------------------------------------------- */
36cdf0e10cSrcweir 
37cdf0e10cSrcweir typedef struct
38cdf0e10cSrcweir {
39cdf0e10cSrcweir     sal_uInt16      mnUniChar;
40cdf0e10cSrcweir     sal_uInt16      mnReplaceChar;
41cdf0e10cSrcweir } ImplReplaceCharData;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir static ImplReplaceCharData const aImplRepCharTab[] =
44cdf0e10cSrcweir {
45cdf0e10cSrcweir   { 0x00A0, 0x0020 },   /* NO-BREAK-SPACE */
46cdf0e10cSrcweir   { 0x00A1, 0x0021 },   /* INVERTED EXCLAMATION MARK */
47cdf0e10cSrcweir   { 0x00B7, 0x0045 },   /* MIDDLE DOT */
48cdf0e10cSrcweir   { 0x00BF, 0x003F },   /* INVERTED QUESTION MARK */
49cdf0e10cSrcweir   { 0x00D7, 0x002A },   /* MULTIPLIKATION SIGN */
50cdf0e10cSrcweir   { 0x00F7, 0x002F },   /* DIVISION SIGN */
51cdf0e10cSrcweir   { 0x2000, 0x0020 },   /* EN QUAD */
52cdf0e10cSrcweir   { 0x2001, 0x0020 },   /* EM QUAD */
53cdf0e10cSrcweir   { 0x2002, 0x0020 },   /* EN SPACE */
54cdf0e10cSrcweir   { 0x2003, 0x0020 },   /* EM SPACE */
55cdf0e10cSrcweir   { 0x2004, 0x0020 },   /* THREE-PER-EM SPACE */
56cdf0e10cSrcweir   { 0x2005, 0x0020 },   /* FOUR-PER-EM SPACE */
57cdf0e10cSrcweir   { 0x2006, 0x0020 },   /* SIX-PER-EM SPACE */
58cdf0e10cSrcweir   { 0x2007, 0x0020 },   /* FIGURE SPACE */
59cdf0e10cSrcweir   { 0x2008, 0x0020 },   /* PUNCTATION SPACE */
60cdf0e10cSrcweir   { 0x2009, 0x0020 },   /* THIN SPACE */
61cdf0e10cSrcweir   { 0x200A, 0x0020 },   /* HAIR SPACE */
62cdf0e10cSrcweir   { 0x2010, 0x002D },   /* HYPHEN */
63cdf0e10cSrcweir   { 0x2011, 0x002D },   /* NON-BREAKING HYPHEN */
64cdf0e10cSrcweir   { 0x2012, 0x002D },   /* FIGURE DASH */
65cdf0e10cSrcweir   { 0x2013, 0x002D },   /* EN DASH */
66cdf0e10cSrcweir   { 0x2014, 0x002D },   /* EM DASH */
67cdf0e10cSrcweir   { 0x2015, 0x002D },   /* HORIZONTAL BAR */
68cdf0e10cSrcweir   { 0x2018, 0x0027 },   /* LEFT SINGLE QUOTATION MARK */
69cdf0e10cSrcweir   { 0x2019, 0x0027 },   /* RIGHT SINGLE QUOTATION MARK */
70cdf0e10cSrcweir   { 0x201A, 0x002C },   /* SINGLE LOW-9 QUOTATION MARK */
71cdf0e10cSrcweir   { 0x201B, 0x0027 },   /* SINGLE HIGH-RESERVED-9 QUOTATION MARK */
72cdf0e10cSrcweir   { 0x201C, 0x0022 },   /* LEFT DOUBLE QUOTATION MARK */
73cdf0e10cSrcweir   { 0x201D, 0x0022 },   /* RIGHT DOUBLE QUOTATION MARK */
74cdf0e10cSrcweir   { 0x201E, 0x0022 },   /* DOUBLE LOW-9 QUOTATION MARK */
75cdf0e10cSrcweir   { 0x201F, 0x0022 },   /* DOUBLE HIGH-RESERVED-9 QUOTATION MARK */
76cdf0e10cSrcweir   { 0x2022, 0x002D },   /* BULLET */
77cdf0e10cSrcweir   { 0x2023, 0x002D },   /* TRIANGULAR BULLET */
78cdf0e10cSrcweir   { 0x2024, 0x002D },   /* ONE DOT LEADER */
79cdf0e10cSrcweir   { 0x2027, 0x002D },   /* HYPHENATION POINT */
80cdf0e10cSrcweir   { 0x2028, 0x000A },   /* LINE SEPARATOR */
81cdf0e10cSrcweir   { 0x2029, 0x000D },   /* PARAGRAPH SEPARATOR */
82cdf0e10cSrcweir   { 0x2032, 0x0027 },   /* PRIME */
83cdf0e10cSrcweir   { 0x2033, 0x0022 },   /* DOUBLE PRIME */
84cdf0e10cSrcweir   { 0x2035, 0x0027 },   /* RESERVED PRIME */
85cdf0e10cSrcweir   { 0x2036, 0x0022 },   /* RESERVED DOUBLE PRIME */
86cdf0e10cSrcweir   { 0x2039, 0x003C },   /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */
87cdf0e10cSrcweir   { 0x203A, 0x003E },   /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */
88cdf0e10cSrcweir   { 0x2043, 0x002D },   /* HYPHEN BULLET */
89cdf0e10cSrcweir   { 0x2044, 0x002F },   /* FRACTION SLASH */
90cdf0e10cSrcweir   { 0x2160, 0x0049 },   /* ROMAN NUMERAL ONE */
91cdf0e10cSrcweir   { 0x2164, 0x0056 },   /* ROMAN NUMERAL FIVE */
92cdf0e10cSrcweir   { 0x2169, 0x0058 },   /* ROMAN NUMERAL TEN */
93cdf0e10cSrcweir   { 0x216C, 0x004C },   /* ROMAN NUMERAL FIFTY */
94cdf0e10cSrcweir   { 0x216D, 0x0043 },   /* ROMAN NUMERAL ONE HUNDRED */
95cdf0e10cSrcweir   { 0x216E, 0x0044 },   /* ROMAN NUMERAL FIVE HUNDRED */
96cdf0e10cSrcweir   { 0x216F, 0x004D },   /* ROMAN NUMERAL ONE THOUSAND */
97cdf0e10cSrcweir   { 0x2170, 0x0069 },   /* SMALL ROMAN NUMERAL ONE */
98cdf0e10cSrcweir   { 0x2174, 0x0076 },   /* SMALL ROMAN NUMERAL FIVE */
99cdf0e10cSrcweir   { 0x2179, 0x0078 },   /* SMALL ROMAN NUMERAL TEN */
100cdf0e10cSrcweir   { 0x217C, 0x006C },   /* SMALL ROMAN NUMERAL FIFTY */
101cdf0e10cSrcweir   { 0x217D, 0x0063 },   /* SMALL ROMAN NUMERAL ONE HUNDRED */
102cdf0e10cSrcweir   { 0x217E, 0x0064 },   /* SMALL ROMAN NUMERAL FIVE HUNDRED */
103cdf0e10cSrcweir   { 0x217F, 0x006D },   /* SMALL ROMAN NUMERAL ONE THOUSAND */
104cdf0e10cSrcweir   { 0x2215, 0x002F },   /* DIVISION SLASH */
105cdf0e10cSrcweir   { 0x2217, 0x002A },   /* ASTERIX OPERATOR */
106cdf0e10cSrcweir   { 0xFF00, 0x0020 },   /* FULLWIDTH ASCII FORMS */
107cdf0e10cSrcweir   { 0xFF01, 0x0021 },   /* FULLWIDTH ASCII FORMS */
108cdf0e10cSrcweir   { 0xFF02, 0x0022 },   /* FULLWIDTH ASCII FORMS*/
109cdf0e10cSrcweir   { 0xFF03, 0x0023 },   /* FULLWIDTH ASCII FORMS */
110cdf0e10cSrcweir   { 0xFF04, 0x0024 },   /* FULLWIDTH ASCII FORMS*/
111cdf0e10cSrcweir   { 0xFF05, 0x0025 },   /* FULLWIDTH ASCII FORMS */
112cdf0e10cSrcweir   { 0xFF06, 0x0026 },   /* FULLWIDTH ASCII FORMS*/
113cdf0e10cSrcweir   { 0xFF07, 0x0027 },   /* FULLWIDTH ASCII FORMS */
114cdf0e10cSrcweir   { 0xFF08, 0x0028 },   /* FULLWIDTH ASCII FORMS*/
115cdf0e10cSrcweir   { 0xFF09, 0x0029 },   /* FULLWIDTH ASCII FORMS */
116cdf0e10cSrcweir   { 0xFF0A, 0x002A },   /* FULLWIDTH ASCII FORMS*/
117cdf0e10cSrcweir   { 0xFF0B, 0x002B },   /* FULLWIDTH ASCII FORMS */
118cdf0e10cSrcweir   { 0xFF0C, 0x002C },   /* FULLWIDTH ASCII FORMS*/
119cdf0e10cSrcweir   { 0xFF0D, 0x002D },   /* FULLWIDTH ASCII FORMS */
120cdf0e10cSrcweir   { 0xFF0E, 0x002E },   /* FULLWIDTH ASCII FORMS*/
121cdf0e10cSrcweir   { 0xFF0F, 0x002F },   /* FULLWIDTH ASCII FORMS */
122cdf0e10cSrcweir   { 0xFF10, 0x0030 },   /* FULLWIDTH ASCII FORMS */
123cdf0e10cSrcweir   { 0xFF11, 0x0031 },   /* FULLWIDTH ASCII FORMS */
124cdf0e10cSrcweir   { 0xFF12, 0x0032 },   /* FULLWIDTH ASCII FORMS*/
125cdf0e10cSrcweir   { 0xFF13, 0x0033 },   /* FULLWIDTH ASCII FORMS */
126cdf0e10cSrcweir   { 0xFF14, 0x0034 },   /* FULLWIDTH ASCII FORMS*/
127cdf0e10cSrcweir   { 0xFF15, 0x0035 },   /* FULLWIDTH ASCII FORMS */
128cdf0e10cSrcweir   { 0xFF16, 0x0036 },   /* FULLWIDTH ASCII FORMS*/
129cdf0e10cSrcweir   { 0xFF17, 0x0037 },   /* FULLWIDTH ASCII FORMS */
130cdf0e10cSrcweir   { 0xFF18, 0x0038 },   /* FULLWIDTH ASCII FORMS*/
131cdf0e10cSrcweir   { 0xFF19, 0x0039 },   /* FULLWIDTH ASCII FORMS */
132cdf0e10cSrcweir   { 0xFF1A, 0x003A },   /* FULLWIDTH ASCII FORMS*/
133cdf0e10cSrcweir   { 0xFF1B, 0x003B },   /* FULLWIDTH ASCII FORMS */
134cdf0e10cSrcweir   { 0xFF1C, 0x003C },   /* FULLWIDTH ASCII FORMS*/
135cdf0e10cSrcweir   { 0xFF1D, 0x003D },   /* FULLWIDTH ASCII FORMS */
136cdf0e10cSrcweir   { 0xFF1E, 0x003E },   /* FULLWIDTH ASCII FORMS*/
137cdf0e10cSrcweir   { 0xFF1F, 0x003F },   /* FULLWIDTH ASCII FORMS */
138cdf0e10cSrcweir   { 0xFF20, 0x0040 },   /* FULLWIDTH ASCII FORMS */
139cdf0e10cSrcweir   { 0xFF21, 0x0041 },   /* FULLWIDTH ASCII FORMS */
140cdf0e10cSrcweir   { 0xFF22, 0x0042 },   /* FULLWIDTH ASCII FORMS*/
141cdf0e10cSrcweir   { 0xFF23, 0x0043 },   /* FULLWIDTH ASCII FORMS */
142cdf0e10cSrcweir   { 0xFF24, 0x0044 },   /* FULLWIDTH ASCII FORMS*/
143cdf0e10cSrcweir   { 0xFF25, 0x0045 },   /* FULLWIDTH ASCII FORMS */
144cdf0e10cSrcweir   { 0xFF26, 0x0046 },   /* FULLWIDTH ASCII FORMS*/
145cdf0e10cSrcweir   { 0xFF27, 0x0047 },   /* FULLWIDTH ASCII FORMS */
146cdf0e10cSrcweir   { 0xFF28, 0x0048 },   /* FULLWIDTH ASCII FORMS*/
147cdf0e10cSrcweir   { 0xFF29, 0x0049 },   /* FULLWIDTH ASCII FORMS */
148cdf0e10cSrcweir   { 0xFF2A, 0x004A },   /* FULLWIDTH ASCII FORMS*/
149cdf0e10cSrcweir   { 0xFF2B, 0x004B },   /* FULLWIDTH ASCII FORMS */
150cdf0e10cSrcweir   { 0xFF2C, 0x004C },   /* FULLWIDTH ASCII FORMS*/
151cdf0e10cSrcweir   { 0xFF2D, 0x004D },   /* FULLWIDTH ASCII FORMS */
152cdf0e10cSrcweir   { 0xFF2E, 0x004E },   /* FULLWIDTH ASCII FORMS*/
153cdf0e10cSrcweir   { 0xFF2F, 0x004F },   /* FULLWIDTH ASCII FORMS */
154cdf0e10cSrcweir   { 0xFF30, 0x0050 },   /* FULLWIDTH ASCII FORMS */
155cdf0e10cSrcweir   { 0xFF31, 0x0051 },   /* FULLWIDTH ASCII FORMS */
156cdf0e10cSrcweir   { 0xFF32, 0x0052 },   /* FULLWIDTH ASCII FORMS*/
157cdf0e10cSrcweir   { 0xFF33, 0x0053 },   /* FULLWIDTH ASCII FORMS */
158cdf0e10cSrcweir   { 0xFF34, 0x0054 },   /* FULLWIDTH ASCII FORMS*/
159cdf0e10cSrcweir   { 0xFF35, 0x0055 },   /* FULLWIDTH ASCII FORMS */
160cdf0e10cSrcweir   { 0xFF36, 0x0056 },   /* FULLWIDTH ASCII FORMS*/
161cdf0e10cSrcweir   { 0xFF37, 0x0057 },   /* FULLWIDTH ASCII FORMS */
162cdf0e10cSrcweir   { 0xFF38, 0x0058 },   /* FULLWIDTH ASCII FORMS*/
163cdf0e10cSrcweir   { 0xFF39, 0x0059 },   /* FULLWIDTH ASCII FORMS */
164cdf0e10cSrcweir   { 0xFF3A, 0x005A },   /* FULLWIDTH ASCII FORMS*/
165cdf0e10cSrcweir   { 0xFF3B, 0x005B },   /* FULLWIDTH ASCII FORMS */
166cdf0e10cSrcweir   { 0xFF3C, 0x005C },   /* FULLWIDTH ASCII FORMS*/
167cdf0e10cSrcweir   { 0xFF3D, 0x005D },   /* FULLWIDTH ASCII FORMS */
168cdf0e10cSrcweir   { 0xFF3E, 0x005E },   /* FULLWIDTH ASCII FORMS*/
169cdf0e10cSrcweir   { 0xFF3F, 0x005F },   /* FULLWIDTH ASCII FORMS */
170cdf0e10cSrcweir   { 0xFF40, 0x0060 },   /* FULLWIDTH ASCII FORMS */
171cdf0e10cSrcweir   { 0xFF41, 0x0061 },   /* FULLWIDTH ASCII FORMS */
172cdf0e10cSrcweir   { 0xFF42, 0x0062 },   /* FULLWIDTH ASCII FORMS*/
173cdf0e10cSrcweir   { 0xFF43, 0x0063 },   /* FULLWIDTH ASCII FORMS */
174cdf0e10cSrcweir   { 0xFF44, 0x0064 },   /* FULLWIDTH ASCII FORMS*/
175cdf0e10cSrcweir   { 0xFF45, 0x0065 },   /* FULLWIDTH ASCII FORMS */
176cdf0e10cSrcweir   { 0xFF46, 0x0066 },   /* FULLWIDTH ASCII FORMS*/
177cdf0e10cSrcweir   { 0xFF47, 0x0067 },   /* FULLWIDTH ASCII FORMS */
178cdf0e10cSrcweir   { 0xFF48, 0x0068 },   /* FULLWIDTH ASCII FORMS*/
179cdf0e10cSrcweir   { 0xFF49, 0x0069 },   /* FULLWIDTH ASCII FORMS */
180cdf0e10cSrcweir   { 0xFF4A, 0x006A },   /* FULLWIDTH ASCII FORMS*/
181cdf0e10cSrcweir   { 0xFF4B, 0x006B },   /* FULLWIDTH ASCII FORMS */
182cdf0e10cSrcweir   { 0xFF4C, 0x006C },   /* FULLWIDTH ASCII FORMS*/
183cdf0e10cSrcweir   { 0xFF4D, 0x006D },   /* FULLWIDTH ASCII FORMS */
184cdf0e10cSrcweir   { 0xFF4E, 0x006E },   /* FULLWIDTH ASCII FORMS*/
185cdf0e10cSrcweir   { 0xFF4F, 0x006F },   /* FULLWIDTH ASCII FORMS */
186cdf0e10cSrcweir   { 0xFF50, 0x0070 },   /* FULLWIDTH ASCII FORMS */
187cdf0e10cSrcweir   { 0xFF51, 0x0071 },   /* FULLWIDTH ASCII FORMS */
188cdf0e10cSrcweir   { 0xFF52, 0x0072 },   /* FULLWIDTH ASCII FORMS*/
189cdf0e10cSrcweir   { 0xFF53, 0x0073 },   /* FULLWIDTH ASCII FORMS */
190cdf0e10cSrcweir   { 0xFF54, 0x0074 },   /* FULLWIDTH ASCII FORMS*/
191cdf0e10cSrcweir   { 0xFF55, 0x0075 },   /* FULLWIDTH ASCII FORMS */
192cdf0e10cSrcweir   { 0xFF56, 0x0076 },   /* FULLWIDTH ASCII FORMS*/
193cdf0e10cSrcweir   { 0xFF57, 0x0077 },   /* FULLWIDTH ASCII FORMS */
194cdf0e10cSrcweir   { 0xFF58, 0x0078 },   /* FULLWIDTH ASCII FORMS*/
195cdf0e10cSrcweir   { 0xFF59, 0x0079 },   /* FULLWIDTH ASCII FORMS */
196cdf0e10cSrcweir   { 0xFF5A, 0x007A },   /* FULLWIDTH ASCII FORMS*/
197cdf0e10cSrcweir   { 0xFF5B, 0x007B },   /* FULLWIDTH ASCII FORMS */
198cdf0e10cSrcweir   { 0xFF5C, 0x007C },   /* FULLWIDTH ASCII FORMS*/
199cdf0e10cSrcweir   { 0xFF5D, 0x007D },   /* FULLWIDTH ASCII FORMS */
200cdf0e10cSrcweir   { 0xFF5E, 0x007E },   /* FULLWIDTH ASCII FORMS*/
201cdf0e10cSrcweir   { 0xFF5F, 0x007F },   /* FULLWIDTH ASCII FORMS */
202cdf0e10cSrcweir   { 0xFF61, 0x3002 },   /* HALFWIDTH KATAKANA FORMS */
203cdf0e10cSrcweir   { 0xFF62, 0x300C },   /* HALFWIDTH KATAKANA FORMS */
204cdf0e10cSrcweir   { 0xFF63, 0x300D },   /* HALFWIDTH KATAKANA FORMS */
205cdf0e10cSrcweir   { 0xFF64, 0x3001 },   /* HALFWIDTH KATAKANA FORMS */
206cdf0e10cSrcweir   { 0xFF65, 0x30FB },   /* HALFWIDTH KATAKANA FORMS */
207cdf0e10cSrcweir   { 0xFF66, 0x30F2 },   /* HALFWIDTH KATAKANA FORMS */
208cdf0e10cSrcweir   { 0xFF67, 0x30A1 },   /* HALFWIDTH KATAKANA FORMS */
209cdf0e10cSrcweir   { 0xFF68, 0x30A3 },   /* HALFWIDTH KATAKANA FORMS */
210cdf0e10cSrcweir   { 0xFF69, 0x30A5 },   /* HALFWIDTH KATAKANA FORMS */
211cdf0e10cSrcweir   { 0xFF6A, 0x30A7 },   /* HALFWIDTH KATAKANA FORMS */
212cdf0e10cSrcweir   { 0xFF6B, 0x30A9 },   /* HALFWIDTH KATAKANA FORMS */
213cdf0e10cSrcweir   { 0xFF6C, 0x30E3 },   /* HALFWIDTH KATAKANA FORMS */
214cdf0e10cSrcweir   { 0xFF6D, 0x30E5 },   /* HALFWIDTH KATAKANA FORMS */
215cdf0e10cSrcweir   { 0xFF6E, 0x30E7 },   /* HALFWIDTH KATAKANA FORMS */
216cdf0e10cSrcweir   { 0xFF6F, 0x30C3 },   /* HALFWIDTH KATAKANA FORMS */
217cdf0e10cSrcweir   { 0xFF70, 0x30FC },   /* HALFWIDTH KATAKANA FORMS */
218cdf0e10cSrcweir   { 0xFF71, 0x30A2 },   /* HALFWIDTH KATAKANA FORMS */
219cdf0e10cSrcweir   { 0xFF72, 0x30A4 },   /* HALFWIDTH KATAKANA FORMS */
220cdf0e10cSrcweir   { 0xFF73, 0x30A6 },   /* HALFWIDTH KATAKANA FORMS */
221cdf0e10cSrcweir   { 0xFF74, 0x30A8 },   /* HALFWIDTH KATAKANA FORMS */
222cdf0e10cSrcweir   { 0xFF75, 0x30AA },   /* HALFWIDTH KATAKANA FORMS */
223cdf0e10cSrcweir   { 0xFF76, 0x30AB },   /* HALFWIDTH KATAKANA FORMS */
224cdf0e10cSrcweir   { 0xFF77, 0x30AD },   /* HALFWIDTH KATAKANA FORMS */
225cdf0e10cSrcweir   { 0xFF78, 0x30AF },   /* HALFWIDTH KATAKANA FORMS */
226cdf0e10cSrcweir   { 0xFF79, 0x30B1 },   /* HALFWIDTH KATAKANA FORMS */
227cdf0e10cSrcweir   { 0xFF7A, 0x30B3 },   /* HALFWIDTH KATAKANA FORMS */
228cdf0e10cSrcweir   { 0xFF7B, 0x30B5 },   /* HALFWIDTH KATAKANA FORMS */
229cdf0e10cSrcweir   { 0xFF7C, 0x30B7 },   /* HALFWIDTH KATAKANA FORMS */
230cdf0e10cSrcweir   { 0xFF7D, 0x30B9 },   /* HALFWIDTH KATAKANA FORMS */
231cdf0e10cSrcweir   { 0xFF7E, 0x30BB },   /* HALFWIDTH KATAKANA FORMS */
232cdf0e10cSrcweir   { 0xFF7F, 0x30BD },   /* HALFWIDTH KATAKANA FORMS */
233cdf0e10cSrcweir   { 0xFF80, 0x30BF },   /* HALFWIDTH KATAKANA FORMS */
234cdf0e10cSrcweir   { 0xFF81, 0x30C1 },   /* HALFWIDTH KATAKANA FORMS */
235cdf0e10cSrcweir   { 0xFF82, 0x30C4 },   /* HALFWIDTH KATAKANA FORMS */
236cdf0e10cSrcweir   { 0xFF83, 0x30C6 },   /* HALFWIDTH KATAKANA FORMS */
237cdf0e10cSrcweir   { 0xFF84, 0x30C8 },   /* HALFWIDTH KATAKANA FORMS */
238cdf0e10cSrcweir   { 0xFF85, 0x30CA },   /* HALFWIDTH KATAKANA FORMS */
239cdf0e10cSrcweir   { 0xFF86, 0x30CB },   /* HALFWIDTH KATAKANA FORMS */
240cdf0e10cSrcweir   { 0xFF87, 0x30CC },   /* HALFWIDTH KATAKANA FORMS */
241cdf0e10cSrcweir   { 0xFF88, 0x30CD },   /* HALFWIDTH KATAKANA FORMS */
242cdf0e10cSrcweir   { 0xFF89, 0x30CE },   /* HALFWIDTH KATAKANA FORMS */
243cdf0e10cSrcweir   { 0xFF8A, 0x30CF },   /* HALFWIDTH KATAKANA FORMS */
244cdf0e10cSrcweir   { 0xFF8B, 0x30D2 },   /* HALFWIDTH KATAKANA FORMS */
245cdf0e10cSrcweir   { 0xFF8C, 0x30D5 },   /* HALFWIDTH KATAKANA FORMS */
246cdf0e10cSrcweir   { 0xFF8D, 0x30D8 },   /* HALFWIDTH KATAKANA FORMS */
247cdf0e10cSrcweir   { 0xFF8E, 0x30DB },   /* HALFWIDTH KATAKANA FORMS */
248cdf0e10cSrcweir   { 0xFF8F, 0x30DE },   /* HALFWIDTH KATAKANA FORMS */
249cdf0e10cSrcweir   { 0xFF90, 0x30DF },   /* HALFWIDTH KATAKANA FORMS */
250cdf0e10cSrcweir   { 0xFF91, 0x30E0 },   /* HALFWIDTH KATAKANA FORMS */
251cdf0e10cSrcweir   { 0xFF92, 0x30E1 },   /* HALFWIDTH KATAKANA FORMS */
252cdf0e10cSrcweir   { 0xFF93, 0x30E2 },   /* HALFWIDTH KATAKANA FORMS */
253cdf0e10cSrcweir   { 0xFF94, 0x30E4 },   /* HALFWIDTH KATAKANA FORMS */
254cdf0e10cSrcweir   { 0xFF95, 0x30E6 },   /* HALFWIDTH KATAKANA FORMS */
255cdf0e10cSrcweir   { 0xFF96, 0x30E8 },   /* HALFWIDTH KATAKANA FORMS */
256cdf0e10cSrcweir   { 0xFF97, 0x30E9 },   /* HALFWIDTH KATAKANA FORMS */
257cdf0e10cSrcweir   { 0xFF98, 0x30EA },   /* HALFWIDTH KATAKANA FORMS */
258cdf0e10cSrcweir   { 0xFF99, 0x30EB },   /* HALFWIDTH KATAKANA FORMS */
259cdf0e10cSrcweir   { 0xFF9A, 0x30EC },   /* HALFWIDTH KATAKANA FORMS */
260cdf0e10cSrcweir   { 0xFF9B, 0x30ED },   /* HALFWIDTH KATAKANA FORMS */
261cdf0e10cSrcweir   { 0xFF9C, 0x30EF },   /* HALFWIDTH KATAKANA FORMS */
262cdf0e10cSrcweir   { 0xFF9D, 0x30F3 },   /* HALFWIDTH KATAKANA FORMS */
263cdf0e10cSrcweir   { 0xFF9E, 0x309B },   /* HALFWIDTH KATAKANA FORMS */
264cdf0e10cSrcweir   { 0xFF9F, 0x309C },   /* HALFWIDTH KATAKANA FORMS */
265cdf0e10cSrcweir   { 0xFFA0, 0x3164 },   /* HALFWIDTH HANGUL FORMS */
266cdf0e10cSrcweir   { 0xFFA1, 0x3131 },   /* HALFWIDTH HANGUL FORMS */
267cdf0e10cSrcweir   { 0xFFA2, 0x3132 },   /* HALFWIDTH HANGUL FORMS */
268cdf0e10cSrcweir   { 0xFFA3, 0x3133 },   /* HALFWIDTH HANGUL FORMS */
269cdf0e10cSrcweir   { 0xFFA4, 0x3134 },   /* HALFWIDTH HANGUL FORMS */
270cdf0e10cSrcweir   { 0xFFA5, 0x3135 },   /* HALFWIDTH HANGUL FORMS */
271cdf0e10cSrcweir   { 0xFFA6, 0x3136 },   /* HALFWIDTH HANGUL FORMS */
272cdf0e10cSrcweir   { 0xFFA7, 0x3137 },   /* HALFWIDTH HANGUL FORMS */
273cdf0e10cSrcweir   { 0xFFA8, 0x3138 },   /* HALFWIDTH HANGUL FORMS */
274cdf0e10cSrcweir   { 0xFFA9, 0x3139 },   /* HALFWIDTH HANGUL FORMS */
275cdf0e10cSrcweir   { 0xFFAA, 0x313A },   /* HALFWIDTH HANGUL FORMS */
276cdf0e10cSrcweir   { 0xFFAB, 0x313B },   /* HALFWIDTH HANGUL FORMS */
277cdf0e10cSrcweir   { 0xFFAC, 0x313C },   /* HALFWIDTH HANGUL FORMS */
278cdf0e10cSrcweir   { 0xFFAD, 0x313D },   /* HALFWIDTH HANGUL FORMS */
279cdf0e10cSrcweir   { 0xFFAE, 0x313E },   /* HALFWIDTH HANGUL FORMS */
280cdf0e10cSrcweir   { 0xFFAF, 0x313F },   /* HALFWIDTH HANGUL FORMS */
281cdf0e10cSrcweir   { 0xFFB0, 0x3140 },   /* HALFWIDTH HANGUL FORMS */
282cdf0e10cSrcweir   { 0xFFB1, 0x3141 },   /* HALFWIDTH HANGUL FORMS */
283cdf0e10cSrcweir   { 0xFFB2, 0x3142 },   /* HALFWIDTH HANGUL FORMS */
284cdf0e10cSrcweir   { 0xFFB3, 0x3143 },   /* HALFWIDTH HANGUL FORMS */
285cdf0e10cSrcweir   { 0xFFB4, 0x3144 },   /* HALFWIDTH HANGUL FORMS */
286cdf0e10cSrcweir   { 0xFFB5, 0x3145 },   /* HALFWIDTH HANGUL FORMS */
287cdf0e10cSrcweir   { 0xFFB6, 0x3146 },   /* HALFWIDTH HANGUL FORMS */
288cdf0e10cSrcweir   { 0xFFB7, 0x3147 },   /* HALFWIDTH HANGUL FORMS */
289cdf0e10cSrcweir   { 0xFFB8, 0x3148 },   /* HALFWIDTH HANGUL FORMS */
290cdf0e10cSrcweir   { 0xFFB9, 0x3149 },   /* HALFWIDTH HANGUL FORMS */
291cdf0e10cSrcweir   { 0xFFBA, 0x314A },   /* HALFWIDTH HANGUL FORMS */
292cdf0e10cSrcweir   { 0xFFBB, 0x314B },   /* HALFWIDTH HANGUL FORMS */
293cdf0e10cSrcweir   { 0xFFBC, 0x314C },   /* HALFWIDTH HANGUL FORMS */
294cdf0e10cSrcweir   { 0xFFBD, 0x314D },   /* HALFWIDTH HANGUL FORMS */
295cdf0e10cSrcweir   { 0xFFBE, 0x314E },   /* HALFWIDTH HANGUL FORMS */
296cdf0e10cSrcweir   { 0xFFC2, 0x314F },   /* HALFWIDTH HANGUL FORMS */
297cdf0e10cSrcweir   { 0xFFC3, 0x3150 },   /* HALFWIDTH HANGUL FORMS */
298cdf0e10cSrcweir   { 0xFFC4, 0x3151 },   /* HALFWIDTH HANGUL FORMS */
299cdf0e10cSrcweir   { 0xFFC5, 0x3152 },   /* HALFWIDTH HANGUL FORMS */
300cdf0e10cSrcweir   { 0xFFC6, 0x3153 },   /* HALFWIDTH HANGUL FORMS */
301cdf0e10cSrcweir   { 0xFFC7, 0x3154 },   /* HALFWIDTH HANGUL FORMS */
302cdf0e10cSrcweir   { 0xFFCA, 0x3155 },   /* HALFWIDTH HANGUL FORMS */
303cdf0e10cSrcweir   { 0xFFCB, 0x3156 },   /* HALFWIDTH HANGUL FORMS */
304cdf0e10cSrcweir   { 0xFFCC, 0x3157 },   /* HALFWIDTH HANGUL FORMS */
305cdf0e10cSrcweir   { 0xFFCD, 0x3158 },   /* HALFWIDTH HANGUL FORMS */
306cdf0e10cSrcweir   { 0xFFCE, 0x3159 },   /* HALFWIDTH HANGUL FORMS */
307cdf0e10cSrcweir   { 0xFFCF, 0x315A },   /* HALFWIDTH HANGUL FORMS */
308cdf0e10cSrcweir   { 0xFFD2, 0x315B },   /* HALFWIDTH HANGUL FORMS */
309cdf0e10cSrcweir   { 0xFFD3, 0x315C },   /* HALFWIDTH HANGUL FORMS */
310cdf0e10cSrcweir   { 0xFFD4, 0x315D },   /* HALFWIDTH HANGUL FORMS */
311cdf0e10cSrcweir   { 0xFFD5, 0x315E },   /* HALFWIDTH HANGUL FORMS */
312cdf0e10cSrcweir   { 0xFFD6, 0x315F },   /* HALFWIDTH HANGUL FORMS */
313cdf0e10cSrcweir   { 0xFFD7, 0x3160 },   /* HALFWIDTH HANGUL FORMS */
314cdf0e10cSrcweir   { 0xFFDA, 0x3161 },   /* HALFWIDTH HANGUL FORMS */
315cdf0e10cSrcweir   { 0xFFDB, 0x3162 },   /* HALFWIDTH HANGUL FORMS */
316cdf0e10cSrcweir   { 0xFFDC, 0x3163 },   /* HALFWIDTH HANGUL FORMS */
317cdf0e10cSrcweir   { 0xFFE0, 0x00A2 },   /* FULLWIDTH CENT SIGN */
318cdf0e10cSrcweir   { 0xFFE1, 0x00A3 },   /* FULLWIDTH POUND SIGN */
319cdf0e10cSrcweir   { 0xFFE2, 0x00AC },   /* FULLWIDTH NOT SIGN */
320cdf0e10cSrcweir   { 0xFFE3, 0x00AF },   /* FULLWIDTH MACRON */
321cdf0e10cSrcweir   { 0xFFE4, 0x00A6 },   /* FULLWIDTH BROKEN BAR */
322cdf0e10cSrcweir   { 0xFFE5, 0x00A5 },   /* FULLWIDTH YEN SIGN */
323cdf0e10cSrcweir   { 0xFFE6, 0x20A9 },   /* FULLWIDTH WON SIGN */
324cdf0e10cSrcweir   { 0xFFE8, 0x2502 },   /* HALFWIDTH FORMS LIGHT VERTICAL */
325cdf0e10cSrcweir   { 0xFFE9, 0x2190 },   /* HALFWIDTH LEFTWARDS ARROW */
326cdf0e10cSrcweir   { 0xFFEA, 0x2191 },   /* HALFWIDTH UPWARDS ARROW */
327cdf0e10cSrcweir   { 0xFFEB, 0x2192 },   /* HALFWIDTH RIGHTWARDS ARROW */
328cdf0e10cSrcweir   { 0xFFEC, 0x2193 },   /* HALFWIDTH DOWNWARDS ARROW */
329cdf0e10cSrcweir   { 0xFFED, 0x25A0 },   /* HALFWIDTH BLACK SQUARE */
330cdf0e10cSrcweir   { 0xFFEE, 0x25CB },   /* HALFWIDTH WHITE CIRCLE */
331cdf0e10cSrcweir   { 0xFFFD, 0x003F }    /* REPLACEMENT CHARACTER */
332cdf0e10cSrcweir };
333cdf0e10cSrcweir 
ImplGetReplaceChar(sal_Unicode c)334cdf0e10cSrcweir sal_uInt16 ImplGetReplaceChar( sal_Unicode c )
335cdf0e10cSrcweir {
336cdf0e10cSrcweir     sal_uInt16                  nLow;
337cdf0e10cSrcweir     sal_uInt16                  nHigh;
338cdf0e10cSrcweir     sal_uInt16                  nMid;
339cdf0e10cSrcweir     sal_uInt16                  nCompareChar;
340cdf0e10cSrcweir     const ImplReplaceCharData*  pCharData;
341cdf0e10cSrcweir 
342cdf0e10cSrcweir     nLow = 0;
343cdf0e10cSrcweir     nHigh = (sizeof( aImplRepCharTab )/sizeof( ImplReplaceCharData ))-1;
344cdf0e10cSrcweir     do
345cdf0e10cSrcweir     {
346cdf0e10cSrcweir         nMid = (nLow+nHigh)/2;
347cdf0e10cSrcweir         pCharData = aImplRepCharTab+nMid;
348cdf0e10cSrcweir         nCompareChar = pCharData->mnUniChar;
349cdf0e10cSrcweir         if ( c < nCompareChar )
350cdf0e10cSrcweir         {
351cdf0e10cSrcweir             if ( !nMid )
352cdf0e10cSrcweir                 break;
353cdf0e10cSrcweir             nHigh = nMid-1;
354cdf0e10cSrcweir         }
355cdf0e10cSrcweir         else
356cdf0e10cSrcweir         {
357cdf0e10cSrcweir             if ( c > nCompareChar )
358cdf0e10cSrcweir                 nLow = nMid+1;
359cdf0e10cSrcweir             else
360cdf0e10cSrcweir                 return pCharData->mnReplaceChar;
361cdf0e10cSrcweir         }
362cdf0e10cSrcweir     }
363cdf0e10cSrcweir     while ( nLow <= nHigh );
364cdf0e10cSrcweir 
365cdf0e10cSrcweir     return 0;
366cdf0e10cSrcweir }
367cdf0e10cSrcweir 
368cdf0e10cSrcweir /* ----------------------------------------------------------------------- */
369cdf0e10cSrcweir 
370cdf0e10cSrcweir typedef struct
371cdf0e10cSrcweir {
372cdf0e10cSrcweir     sal_uInt16      mnUniChar;
373cdf0e10cSrcweir     sal_uInt16      maReplaceChars[IMPL_MAX_REPLACECHAR];
374cdf0e10cSrcweir } ImplReplaceCharStrData;
375cdf0e10cSrcweir 
376cdf0e10cSrcweir static ImplReplaceCharStrData const aImplRepCharStrTab[] =
377cdf0e10cSrcweir {
378cdf0e10cSrcweir   { 0x00A9, { 0x0028, 0x0063, 0x0029, 0x0000, 0x0000  } },  /* COPYRIGHT SIGN */
379cdf0e10cSrcweir   { 0x00AB, { 0x003C, 0x003C, 0x0000, 0x0000, 0x0000  } },  /* LEFT-POINTING-DOUBLE ANGLE QUOTATION MARK */
380cdf0e10cSrcweir   { 0x0AE0, { 0x0028, 0x0072, 0x0029, 0x0000, 0x0000  } },  /* REGISTERED SIGN */
381cdf0e10cSrcweir   { 0x00BB, { 0x003E, 0x003E, 0x0000, 0x0000, 0x0000  } },  /* RIGHT-POINTING-DOUBLE ANGLE QUOTATION MARK */
382cdf0e10cSrcweir   { 0x00BC, { 0x0031, 0x002F, 0x0034, 0x0000, 0x0000  } },  /* VULGAR FRACTION ONE QUARTER */
383cdf0e10cSrcweir   { 0x00BD, { 0x0031, 0x002F, 0x0032, 0x0000, 0x0000  } },  /* VULGAR FRACTION ONE HALF */
384cdf0e10cSrcweir   { 0x00BE, { 0x0033, 0x002F, 0x0034, 0x0000, 0x0000  } },  /* VULGAR FRACTION THREE QUARTERS */
385cdf0e10cSrcweir   { 0x00C6, { 0x0041, 0x0045, 0x0000, 0x0000, 0x0000  } },  /* LATIN CAPITAL LETTER AE */
386cdf0e10cSrcweir   { 0x00E6, { 0x0061, 0x0065, 0x0000, 0x0000, 0x0000  } },  /* LATIN SMALL LETTER AE */
387cdf0e10cSrcweir   { 0x0152, { 0x004F, 0x0045, 0x0000, 0x0000, 0x0000  } },  /* LATIN CAPITAL LIGATURE OE */
388cdf0e10cSrcweir   { 0x0153, { 0x006F, 0x0065, 0x0000, 0x0000, 0x0000  } },  /* LATIN SMALL LIGATURE OE */
389cdf0e10cSrcweir   { 0x2025, { 0x002E, 0x002E, 0x0000, 0x0000, 0x0000  } },  /* TWO DOT LEADER */
390cdf0e10cSrcweir   { 0x2026, { 0x002E, 0x002E, 0x002E, 0x0000, 0x0000  } },  /* HORIZONTAL ELLIPSES */
391cdf0e10cSrcweir   { 0x2034, { 0x0027, 0x0027, 0x0027, 0x0000, 0x0000  } },  /* TRIPPLE PRIME */
392cdf0e10cSrcweir   { 0x2037, { 0x0027, 0x0027, 0x0027, 0x0000, 0x0000  } },  /* RESERVED TRIPPLE PRIME */
393cdf0e10cSrcweir   { 0x20AC, { 0x0045, 0x0055, 0x0052, 0x0000, 0x0000  } },  /* EURO SIGN */
394cdf0e10cSrcweir   { 0x2122, { 0x0028, 0x0074, 0x006D, 0x0029, 0x0000  } },  /* TRADE MARK SIGN */
395cdf0e10cSrcweir   { 0x2153, { 0x0031, 0x002F, 0x0033, 0x0000, 0x0000  } },  /* VULGAR FRACTION ONE THIRD */
396cdf0e10cSrcweir   { 0x2154, { 0x0032, 0x002F, 0x0033, 0x0000, 0x0000  } },  /* VULGAR FRACTION TWO THIRD */
397cdf0e10cSrcweir   { 0x2155, { 0x0031, 0x002F, 0x0035, 0x0000, 0x0000  } },  /* VULGAR FRACTION ONE FIFTH */
398cdf0e10cSrcweir   { 0x2156, { 0x0032, 0x002F, 0x0035, 0x0000, 0x0000  } },  /* VULGAR FRACTION TWO FIFTH */
399cdf0e10cSrcweir   { 0x2157, { 0x0033, 0x002F, 0x0035, 0x0000, 0x0000  } },  /* VULGAR FRACTION THREE FIFTH */
400cdf0e10cSrcweir   { 0x2158, { 0x0034, 0x002F, 0x0035, 0x0000, 0x0000  } },  /* VULGAR FRACTION FOUR FIFTH */
401cdf0e10cSrcweir   { 0x2159, { 0x0031, 0x002F, 0x0036, 0x0000, 0x0000  } },  /* VULGAR FRACTION ONE SIXTH */
402cdf0e10cSrcweir   { 0x215A, { 0x0035, 0x002F, 0x0036, 0x0000, 0x0000  } },  /* VULGAR FRACTION FIVE SIXTH */
403cdf0e10cSrcweir   { 0x215B, { 0x0031, 0x002F, 0x0038, 0x0000, 0x0000  } },  /* VULGAR FRACTION ONE EIGHTH */
404cdf0e10cSrcweir   { 0x215C, { 0x0033, 0x002F, 0x0038, 0x0000, 0x0000  } },  /* VULGAR FRACTION THREE EIGHTH */
405cdf0e10cSrcweir   { 0x215D, { 0x0035, 0x002F, 0x0038, 0x0000, 0x0000  } },  /* VULGAR FRACTION FIVE EIGHTH */
406cdf0e10cSrcweir   { 0x215E, { 0x0037, 0x002F, 0x0038, 0x0000, 0x0000  } },  /* VULGAR FRACTION SEVEN EIGHTH */
407cdf0e10cSrcweir   { 0x215F, { 0x0031, 0x002F, 0x0000, 0x0000, 0x0000  } },  /* FRACTION NUMERATOR ONE */
408cdf0e10cSrcweir   { 0x2161, { 0x0049, 0x0049, 0x0000, 0x0000, 0x0000  } },  /* ROMAN NUMERAL TWO */
409cdf0e10cSrcweir   { 0x2162, { 0x0049, 0x0049, 0x0049, 0x0000, 0x0000  } },  /* ROMAN NUMERAL THREE */
410cdf0e10cSrcweir   { 0x2163, { 0x0049, 0x0056, 0x0000, 0x0000, 0x0000  } },  /* ROMAN NUMERAL FOUR */
411cdf0e10cSrcweir   { 0x2165, { 0x0056, 0x0049, 0x0000, 0x0000, 0x0000  } },  /* ROMAN NUMERAL SIX */
412cdf0e10cSrcweir   { 0x2166, { 0x0056, 0x0049, 0x0049, 0x0000, 0x0000  } },  /* ROMAN NUMERAL SEVEN */
413cdf0e10cSrcweir   { 0x2168, { 0x0056, 0x0049, 0x0049, 0x0049, 0x0000  } },  /* ROMAN NUMERAL EIGHT */
414cdf0e10cSrcweir   { 0x2169, { 0x0049, 0x0058, 0x0000, 0x0000, 0x0000  } },  /* ROMAN NUMERAL NINE */
415cdf0e10cSrcweir   { 0x216A, { 0x0058, 0x0049, 0x0000, 0x0000, 0x0000  } },  /* ROMAN NUMERAL ELEVEN */
416cdf0e10cSrcweir   { 0x216B, { 0x0058, 0x0049, 0x0049, 0x0000, 0x0000  } },  /* ROMAN NUMERAL TWELVE */
417cdf0e10cSrcweir   { 0x2171, { 0x0069, 0x0069, 0x0000, 0x0000, 0x0000  } },  /* SMALL ROMAN NUMERAL TWO */
418cdf0e10cSrcweir   { 0x2172, { 0x0069, 0x0069, 0x0069, 0x0000, 0x0000  } },  /* SMALL ROMAN NUMERAL THREE */
419cdf0e10cSrcweir   { 0x2173, { 0x0069, 0x0076, 0x0000, 0x0000, 0x0000  } },  /* SMALL ROMAN NUMERAL FOUR */
420cdf0e10cSrcweir   { 0x2175, { 0x0076, 0x0069, 0x0000, 0x0000, 0x0000  } },  /* SMALL ROMAN NUMERAL SIX */
421cdf0e10cSrcweir   { 0x2176, { 0x0076, 0x0069, 0x0069, 0x0000, 0x0000  } },  /* SMALL ROMAN NUMERAL SEVEN */
422cdf0e10cSrcweir   { 0x2178, { 0x0076, 0x0069, 0x0069, 0x0069, 0x0000  } },  /* SMALL ROMAN NUMERAL EIGHT */
423cdf0e10cSrcweir   { 0x2179, { 0x0069, 0x0078, 0x0000, 0x0000, 0x0000  } },  /* SMALL ROMAN NUMERAL NINE */
424cdf0e10cSrcweir   { 0x217A, { 0x0078, 0x0069, 0x0000, 0x0000, 0x0000  } },  /* SMALL ROMAN NUMERAL ELEVEN */
425cdf0e10cSrcweir   { 0x217B, { 0x0058, 0x0069, 0x0069, 0x0000, 0x0000  } }   /* SMALL ROMAN NUMERAL TWELVE */
426cdf0e10cSrcweir };
427cdf0e10cSrcweir 
ImplGetReplaceString(sal_Unicode c)428cdf0e10cSrcweir const sal_uInt16* ImplGetReplaceString( sal_Unicode c )
429cdf0e10cSrcweir {
430cdf0e10cSrcweir     sal_uInt16                      nLow;
431cdf0e10cSrcweir     sal_uInt16                      nHigh;
432cdf0e10cSrcweir     sal_uInt16                      nMid;
433cdf0e10cSrcweir     sal_uInt16                      nCompareChar;
434cdf0e10cSrcweir     const ImplReplaceCharStrData*   pCharData;
435cdf0e10cSrcweir 
436cdf0e10cSrcweir     nLow = 0;
437cdf0e10cSrcweir     nHigh = (sizeof( aImplRepCharStrTab )/sizeof( ImplReplaceCharStrData ))-1;
438cdf0e10cSrcweir     do
439cdf0e10cSrcweir     {
440cdf0e10cSrcweir         nMid = (nLow+nHigh)/2;
441cdf0e10cSrcweir         pCharData = aImplRepCharStrTab+nMid;
442cdf0e10cSrcweir         nCompareChar = pCharData->mnUniChar;
443cdf0e10cSrcweir         if ( c < nCompareChar )
444cdf0e10cSrcweir         {
445cdf0e10cSrcweir             if ( !nMid )
446cdf0e10cSrcweir                 break;
447cdf0e10cSrcweir             nHigh = nMid-1;
448cdf0e10cSrcweir         }
449cdf0e10cSrcweir         else
450cdf0e10cSrcweir         {
451cdf0e10cSrcweir             if ( c > nCompareChar )
452cdf0e10cSrcweir                 nLow = nMid+1;
453cdf0e10cSrcweir             else
454cdf0e10cSrcweir                 return pCharData->maReplaceChars;
455cdf0e10cSrcweir         }
456cdf0e10cSrcweir     }
457cdf0e10cSrcweir     while ( nLow <= nHigh );
458cdf0e10cSrcweir 
459cdf0e10cSrcweir     return 0;
460cdf0e10cSrcweir }
461cdf0e10cSrcweir 
462cdf0e10cSrcweir /* ======================================================================= */
463cdf0e10cSrcweir 
ImplSymbolToUnicode(const ImplTextConverterData * pData,void * pContext,const sal_Char * pSrcBuf,sal_Size nSrcBytes,sal_Unicode * pDestBuf,sal_Size nDestChars,sal_uInt32 nFlags,sal_uInt32 * pInfo,sal_Size * pSrcCvtBytes)464cdf0e10cSrcweir sal_Size ImplSymbolToUnicode( const ImplTextConverterData* pData,
465cdf0e10cSrcweir                               void* pContext,
466cdf0e10cSrcweir                               const sal_Char* pSrcBuf, sal_Size nSrcBytes,
467cdf0e10cSrcweir                               sal_Unicode* pDestBuf, sal_Size nDestChars,
468cdf0e10cSrcweir                               sal_uInt32 nFlags, sal_uInt32* pInfo,
469cdf0e10cSrcweir                               sal_Size* pSrcCvtBytes )
470cdf0e10cSrcweir {
471cdf0e10cSrcweir     sal_uChar               c;
472cdf0e10cSrcweir     sal_Unicode*            pEndDestBuf;
473cdf0e10cSrcweir     const sal_Char*         pEndSrcBuf;
474cdf0e10cSrcweir 
475cdf0e10cSrcweir     (void) pData; /* unused */
476cdf0e10cSrcweir     (void) pContext; /* unused */
477cdf0e10cSrcweir     (void) nFlags; /* unused */
478cdf0e10cSrcweir 
479cdf0e10cSrcweir     *pInfo = 0;
480cdf0e10cSrcweir     pEndDestBuf = pDestBuf+nDestChars;
481cdf0e10cSrcweir     pEndSrcBuf  = pSrcBuf+nSrcBytes;
482cdf0e10cSrcweir     while ( pSrcBuf < pEndSrcBuf )
483cdf0e10cSrcweir     {
484cdf0e10cSrcweir         if ( pDestBuf == pEndDestBuf )
485cdf0e10cSrcweir         {
486cdf0e10cSrcweir             *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL;
487cdf0e10cSrcweir             break;
488cdf0e10cSrcweir         }
489cdf0e10cSrcweir 
490cdf0e10cSrcweir         /* 0-31 (all Control-Character get the same Unicode value) */
491cdf0e10cSrcweir         c = (sal_uChar)*pSrcBuf;
492cdf0e10cSrcweir         if ( c <= 0x1F )
493cdf0e10cSrcweir             *pDestBuf = (sal_Unicode)c;
494cdf0e10cSrcweir         else
495cdf0e10cSrcweir             *pDestBuf = ((sal_Unicode)c)+0xF000;
496cdf0e10cSrcweir         pDestBuf++;
497cdf0e10cSrcweir         pSrcBuf++;
498cdf0e10cSrcweir     }
499cdf0e10cSrcweir 
500cdf0e10cSrcweir     *pSrcCvtBytes = nSrcBytes - (pEndSrcBuf-pSrcBuf);
501cdf0e10cSrcweir     return (nDestChars - (pEndDestBuf-pDestBuf));
502cdf0e10cSrcweir }
503cdf0e10cSrcweir 
504cdf0e10cSrcweir /* ----------------------------------------------------------------------- */
505cdf0e10cSrcweir 
ImplUnicodeToSymbol(const ImplTextConverterData * pData,void * pContext,const sal_Unicode * pSrcBuf,sal_Size nSrcChars,sal_Char * pDestBuf,sal_Size nDestBytes,sal_uInt32 nFlags,sal_uInt32 * pInfo,sal_Size * pSrcCvtChars)506cdf0e10cSrcweir sal_Size ImplUnicodeToSymbol( const ImplTextConverterData* pData,
507cdf0e10cSrcweir                               void* pContext,
508cdf0e10cSrcweir                               const sal_Unicode* pSrcBuf, sal_Size nSrcChars,
509cdf0e10cSrcweir                               sal_Char* pDestBuf, sal_Size nDestBytes,
510cdf0e10cSrcweir                               sal_uInt32 nFlags, sal_uInt32* pInfo,
511cdf0e10cSrcweir                               sal_Size* pSrcCvtChars )
512cdf0e10cSrcweir {
513cdf0e10cSrcweir     sal_Unicode             c;
514cdf0e10cSrcweir     sal_Char*               pEndDestBuf;
515cdf0e10cSrcweir     const sal_Unicode*      pEndSrcBuf;
516cdf0e10cSrcweir 
517cdf0e10cSrcweir     (void) pContext; /* unused */
518cdf0e10cSrcweir 
519cdf0e10cSrcweir     *pInfo = 0;
520cdf0e10cSrcweir     pEndDestBuf = pDestBuf+nDestBytes;
521cdf0e10cSrcweir     pEndSrcBuf  = pSrcBuf+nSrcChars;
522cdf0e10cSrcweir     while ( pSrcBuf < pEndSrcBuf )
523cdf0e10cSrcweir     {
524cdf0e10cSrcweir         if ( pDestBuf == pEndDestBuf )
525cdf0e10cSrcweir         {
526cdf0e10cSrcweir             *pInfo |= RTL_UNICODETOTEXT_INFO_ERROR | RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL;
527cdf0e10cSrcweir             break;
528cdf0e10cSrcweir         }
529cdf0e10cSrcweir 
530cdf0e10cSrcweir         c = *pSrcBuf;
531cdf0e10cSrcweir         if ( (c >= 0xF000) && (c <= 0xF0FF) )
532cdf0e10cSrcweir         {
533cdf0e10cSrcweir             *pDestBuf = (sal_Char)(sal_uChar)(c-0xF000);
534cdf0e10cSrcweir             pDestBuf++;
535cdf0e10cSrcweir             pSrcBuf++;
536cdf0e10cSrcweir         }
537cdf0e10cSrcweir         // Normally 0x001F, but in many cases also symbol characters
538cdf0e10cSrcweir         // are stored in the first 256 bytes, so that we don't change
539cdf0e10cSrcweir         // these values
540cdf0e10cSrcweir         else if ( c <= 0x00FF )
541cdf0e10cSrcweir         {
542cdf0e10cSrcweir             *pDestBuf = (sal_Char)(sal_uChar)c;
543cdf0e10cSrcweir             pDestBuf++;
544cdf0e10cSrcweir             pSrcBuf++;
545cdf0e10cSrcweir         }
546cdf0e10cSrcweir         else
547cdf0e10cSrcweir         {
548cdf0e10cSrcweir             if ( nFlags & RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE )
549cdf0e10cSrcweir             {
550cdf0e10cSrcweir                 /* !!! */
551cdf0e10cSrcweir                 /* Only ascii  characters < 0x1F */
552cdf0e10cSrcweir             }
553cdf0e10cSrcweir 
554cdf0e10cSrcweir             /* Handle undefined and surrogates characters */
555cdf0e10cSrcweir             /* (all surrogates characters are undefined) */
556cdf0e10cSrcweir             if (!ImplHandleUndefinedUnicodeToTextChar(pData,
557cdf0e10cSrcweir                                                       &pSrcBuf,
558cdf0e10cSrcweir                                                       pEndSrcBuf,
559cdf0e10cSrcweir                                                       &pDestBuf,
560cdf0e10cSrcweir                                                       pEndDestBuf,
561cdf0e10cSrcweir                                                       nFlags,
562cdf0e10cSrcweir                                                       pInfo))
563cdf0e10cSrcweir                 break;
564cdf0e10cSrcweir         }
565cdf0e10cSrcweir     }
566cdf0e10cSrcweir 
567cdf0e10cSrcweir     *pSrcCvtChars = nSrcChars - (pEndSrcBuf-pSrcBuf);
568cdf0e10cSrcweir     return (nDestBytes - (pEndDestBuf-pDestBuf));
569cdf0e10cSrcweir }
570cdf0e10cSrcweir 
571cdf0e10cSrcweir /* ======================================================================= */
572cdf0e10cSrcweir 
ImplCharToUnicode(const ImplTextConverterData * pData,void * pContext,const sal_Char * pSrcBuf,sal_Size nSrcBytes,sal_Unicode * pDestBuf,sal_Size nDestChars,sal_uInt32 nFlags,sal_uInt32 * pInfo,sal_Size * pSrcCvtBytes)573cdf0e10cSrcweir sal_Size ImplCharToUnicode( const ImplTextConverterData* pData,
574cdf0e10cSrcweir                             void* pContext,
575cdf0e10cSrcweir                             const sal_Char* pSrcBuf, sal_Size nSrcBytes,
576cdf0e10cSrcweir                             sal_Unicode* pDestBuf, sal_Size nDestChars,
577cdf0e10cSrcweir                             sal_uInt32 nFlags, sal_uInt32* pInfo,
578cdf0e10cSrcweir                             sal_Size* pSrcCvtBytes )
579cdf0e10cSrcweir {
580cdf0e10cSrcweir     sal_uChar                   c;
581cdf0e10cSrcweir     sal_Unicode                 cConv;
582cdf0e10cSrcweir     const ImplByteConvertData*  pConvertData = (const ImplByteConvertData*)pData;
583cdf0e10cSrcweir     sal_Unicode*                pEndDestBuf;
584cdf0e10cSrcweir     const sal_Char*             pEndSrcBuf;
585cdf0e10cSrcweir 
586cdf0e10cSrcweir     (void) pContext; /* unused */
587cdf0e10cSrcweir 
588cdf0e10cSrcweir     *pInfo = 0;
589cdf0e10cSrcweir     pEndDestBuf = pDestBuf+nDestChars;
590cdf0e10cSrcweir     pEndSrcBuf  = pSrcBuf+nSrcBytes;
591cdf0e10cSrcweir     while ( pSrcBuf < pEndSrcBuf )
592cdf0e10cSrcweir     {
593cdf0e10cSrcweir         c = (sal_uChar)*pSrcBuf;
594cdf0e10cSrcweir         if ( c < 0x80 )
595cdf0e10cSrcweir             cConv = c;
596cdf0e10cSrcweir         else
597cdf0e10cSrcweir         {
598cdf0e10cSrcweir             if ( (c >= pConvertData->mnToUniStart1) && (c <= pConvertData->mnToUniEnd1) )
599cdf0e10cSrcweir                 cConv = pConvertData->mpToUniTab1[c-pConvertData->mnToUniStart1];
600cdf0e10cSrcweir             else if ( (c >= pConvertData->mnToUniStart2) && (c <= pConvertData->mnToUniEnd2) )
601cdf0e10cSrcweir                 cConv = pConvertData->mpToUniTab2[c-pConvertData->mnToUniStart2];
602cdf0e10cSrcweir             else
603cdf0e10cSrcweir                 cConv = 0;
604cdf0e10cSrcweir             if ( !cConv )
605cdf0e10cSrcweir             {
606cdf0e10cSrcweir                 *pInfo |= RTL_TEXTTOUNICODE_INFO_UNDEFINED;
607cdf0e10cSrcweir                 if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MASK) == RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR )
608cdf0e10cSrcweir                 {
609cdf0e10cSrcweir                     *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR;
610cdf0e10cSrcweir                     break;
611cdf0e10cSrcweir                 }
612cdf0e10cSrcweir                 else if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MASK) == RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE )
613cdf0e10cSrcweir                 {
614cdf0e10cSrcweir                     pSrcBuf++;
615cdf0e10cSrcweir                     continue;
616cdf0e10cSrcweir                 }
617cdf0e10cSrcweir                 else
618cdf0e10cSrcweir                     cConv = ImplGetUndefinedUnicodeChar(c, nFlags);
619cdf0e10cSrcweir             }
620cdf0e10cSrcweir         }
621cdf0e10cSrcweir 
622cdf0e10cSrcweir         if ( pDestBuf == pEndDestBuf )
623cdf0e10cSrcweir         {
624cdf0e10cSrcweir             *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL;
625cdf0e10cSrcweir             break;
626cdf0e10cSrcweir         }
627cdf0e10cSrcweir 
628cdf0e10cSrcweir         *pDestBuf = cConv;
629cdf0e10cSrcweir         pDestBuf++;
630cdf0e10cSrcweir         pSrcBuf++;
631cdf0e10cSrcweir     }
632cdf0e10cSrcweir 
633cdf0e10cSrcweir     *pSrcCvtBytes = nSrcBytes - (pEndSrcBuf-pSrcBuf);
634cdf0e10cSrcweir     return (nDestChars - (pEndDestBuf-pDestBuf));
635cdf0e10cSrcweir }
636cdf0e10cSrcweir 
637cdf0e10cSrcweir /* ----------------------------------------------------------------------- */
638cdf0e10cSrcweir 
639cdf0e10cSrcweir // Writes 0--2 characters to dest:
ImplConvertUnicodeCharToChar(const ImplByteConvertData * pConvertData,sal_Unicode c,sal_Char * dest)640cdf0e10cSrcweir static int ImplConvertUnicodeCharToChar(
641cdf0e10cSrcweir     const ImplByteConvertData* pConvertData, sal_Unicode c, sal_Char * dest )
642cdf0e10cSrcweir {
643cdf0e10cSrcweir     const ImplUniCharTabData*   pToCharExTab;
644cdf0e10cSrcweir 
645cdf0e10cSrcweir     if ( c < 0x80 )
646cdf0e10cSrcweir     {
647cdf0e10cSrcweir         dest[0] = (sal_Char)c;
648cdf0e10cSrcweir         return 1;
649cdf0e10cSrcweir     }
650cdf0e10cSrcweir     if ( (c >= pConvertData->mnToCharStart1) && (c <= pConvertData->mnToCharEnd1) )
651cdf0e10cSrcweir     {
652cdf0e10cSrcweir         dest[0] = (sal_Char)pConvertData->mpToCharTab1[c-pConvertData->mnToCharStart1];
653cdf0e10cSrcweir         if ( dest[0] != 0 )
654cdf0e10cSrcweir             return 1;
655cdf0e10cSrcweir     }
656cdf0e10cSrcweir     else if ( (c >= pConvertData->mnToCharStart2) && (c <= pConvertData->mnToCharEnd2) )
657cdf0e10cSrcweir     {
658cdf0e10cSrcweir         dest[0] = (sal_Char)pConvertData->mpToCharTab2[c-pConvertData->mnToCharStart2];
659cdf0e10cSrcweir         if ( dest[0] != 0 )
660cdf0e10cSrcweir             return 1;
661cdf0e10cSrcweir     }
662cdf0e10cSrcweir     pToCharExTab = pConvertData->mpToCharExTab;
663cdf0e10cSrcweir     if ( pToCharExTab )
664cdf0e10cSrcweir     {
665cdf0e10cSrcweir         sal_uInt16                  nLow;
666cdf0e10cSrcweir         sal_uInt16                  nHigh;
667cdf0e10cSrcweir         sal_uInt16                  nMid;
668cdf0e10cSrcweir         sal_uInt16                  nCompareChar;
669cdf0e10cSrcweir         const ImplUniCharTabData*   pCharExData;
670cdf0e10cSrcweir 
671cdf0e10cSrcweir         nLow = 0;
672cdf0e10cSrcweir         nHigh = pConvertData->mnToCharExCount-1;
673cdf0e10cSrcweir         do
674cdf0e10cSrcweir         {
675cdf0e10cSrcweir             nMid = (nLow+nHigh)/2;
676cdf0e10cSrcweir             pCharExData = pToCharExTab+nMid;
677cdf0e10cSrcweir             nCompareChar = pCharExData->mnUniChar;
678cdf0e10cSrcweir             if ( c < nCompareChar )
679cdf0e10cSrcweir             {
680cdf0e10cSrcweir                 if ( !nMid )
681cdf0e10cSrcweir                     break;
682cdf0e10cSrcweir                 nHigh = nMid-1;
683cdf0e10cSrcweir             }
684cdf0e10cSrcweir             else
685cdf0e10cSrcweir             {
686cdf0e10cSrcweir                 if ( c > nCompareChar )
687cdf0e10cSrcweir                     nLow = nMid+1;
688cdf0e10cSrcweir                 else
689cdf0e10cSrcweir                 {
690cdf0e10cSrcweir                     dest[0] = (sal_Char)pCharExData->mnChar;
691cdf0e10cSrcweir                     if ( pCharExData->mnChar2 == 0 )
692cdf0e10cSrcweir                         return 1;
693cdf0e10cSrcweir                     else
694cdf0e10cSrcweir                     {
695cdf0e10cSrcweir                         dest[1] = (sal_Char)pCharExData->mnChar2;
696cdf0e10cSrcweir                         return 2;
697cdf0e10cSrcweir                     }
698cdf0e10cSrcweir                 }
699cdf0e10cSrcweir             }
700cdf0e10cSrcweir         }
701cdf0e10cSrcweir         while ( nLow <= nHigh );
702cdf0e10cSrcweir     }
703cdf0e10cSrcweir     return 0;
704cdf0e10cSrcweir }
705cdf0e10cSrcweir 
706cdf0e10cSrcweir /* ----------------------------------------------------------------------- */
707cdf0e10cSrcweir 
ImplUnicodeToChar(const ImplTextConverterData * pData,void * pContext,const sal_Unicode * pSrcBuf,sal_Size nSrcChars,sal_Char * pDestBuf,sal_Size nDestBytes,sal_uInt32 nFlags,sal_uInt32 * pInfo,sal_Size * pSrcCvtChars)708cdf0e10cSrcweir sal_Size ImplUnicodeToChar( const ImplTextConverterData* pData,
709cdf0e10cSrcweir                             void* pContext,
710cdf0e10cSrcweir                             const sal_Unicode* pSrcBuf, sal_Size nSrcChars,
711cdf0e10cSrcweir                             sal_Char* pDestBuf, sal_Size nDestBytes,
712cdf0e10cSrcweir                             sal_uInt32 nFlags, sal_uInt32* pInfo,
713cdf0e10cSrcweir                             sal_Size* pSrcCvtChars )
714cdf0e10cSrcweir {
715cdf0e10cSrcweir     sal_Unicode                 c;
716cdf0e10cSrcweir     const ImplByteConvertData*  pConvertData = (const ImplByteConvertData*)pData;
717cdf0e10cSrcweir     sal_Char*                   pEndDestBuf;
718cdf0e10cSrcweir     const sal_Unicode*          pEndSrcBuf;
719cdf0e10cSrcweir     int                         i;
720cdf0e10cSrcweir     int                         n;
721cdf0e10cSrcweir     sal_uInt16                  cTemp;
722cdf0e10cSrcweir     sal_Char                    aTempBuf[IMPL_MAX_REPLACECHAR+2];
723cdf0e10cSrcweir     const sal_uInt16*           pReplace;
724cdf0e10cSrcweir 
725cdf0e10cSrcweir     (void) pContext; /* unused */
726cdf0e10cSrcweir 
727cdf0e10cSrcweir     *pInfo = 0;
728cdf0e10cSrcweir     pEndDestBuf = pDestBuf+nDestBytes;
729cdf0e10cSrcweir     pEndSrcBuf  = pSrcBuf+nSrcChars;
730cdf0e10cSrcweir     while ( pSrcBuf < pEndSrcBuf )
731cdf0e10cSrcweir     {
732cdf0e10cSrcweir         c = *pSrcBuf;
733cdf0e10cSrcweir         if ( c < 0x80 )
734cdf0e10cSrcweir         {
735cdf0e10cSrcweir             aTempBuf[0] = (sal_Char)c;
736cdf0e10cSrcweir             n = 1;
737cdf0e10cSrcweir         }
738cdf0e10cSrcweir         else
739cdf0e10cSrcweir         {
740cdf0e10cSrcweir             n = ImplConvertUnicodeCharToChar( pConvertData, c, aTempBuf );
741cdf0e10cSrcweir 
742cdf0e10cSrcweir             if ( n == 0 )
743cdf0e10cSrcweir             {
744cdf0e10cSrcweir                 if ( nFlags & RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE )
745cdf0e10cSrcweir                 {
746cdf0e10cSrcweir                     cTemp = ImplGetReplaceChar( c );
747cdf0e10cSrcweir                     if ( cTemp )
748cdf0e10cSrcweir                         n = ImplConvertUnicodeCharToChar(
749cdf0e10cSrcweir                             pConvertData, cTemp, aTempBuf );
750cdf0e10cSrcweir                 }
751cdf0e10cSrcweir 
752cdf0e10cSrcweir                 if ( n == 0 )
753cdf0e10cSrcweir                 {
754cdf0e10cSrcweir                     if ( nFlags & RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR )
755cdf0e10cSrcweir                     {
756cdf0e10cSrcweir                         pReplace = ImplGetReplaceString( c );
757cdf0e10cSrcweir                         if ( pReplace )
758cdf0e10cSrcweir                         {
759cdf0e10cSrcweir                             while ( *pReplace && (n < IMPL_MAX_REPLACECHAR) )
760cdf0e10cSrcweir                             {
761cdf0e10cSrcweir                                 i = ImplConvertUnicodeCharToChar(
762cdf0e10cSrcweir                                     pConvertData, *pReplace, aTempBuf + n );
763cdf0e10cSrcweir                                 if ( i == 0 )
764cdf0e10cSrcweir                                 {
765cdf0e10cSrcweir                                     n = 0;
766cdf0e10cSrcweir                                     break;
767cdf0e10cSrcweir                                 }
768cdf0e10cSrcweir                                 pReplace++;
769cdf0e10cSrcweir                                 n += i;
770cdf0e10cSrcweir                             }
771cdf0e10cSrcweir                         }
772cdf0e10cSrcweir                     }
773cdf0e10cSrcweir 
774cdf0e10cSrcweir                     /* Handle undefined and surrogates characters */
775cdf0e10cSrcweir                     /* (all surrogates characters are undefined) */
776cdf0e10cSrcweir                     if ( n == 0 )
777cdf0e10cSrcweir                     {
778cdf0e10cSrcweir                         if (ImplHandleUndefinedUnicodeToTextChar(pData,
779cdf0e10cSrcweir                                                                  &pSrcBuf,
780cdf0e10cSrcweir                                                                  pEndSrcBuf,
781cdf0e10cSrcweir                                                                  &pDestBuf,
782cdf0e10cSrcweir                                                                  pEndDestBuf,
783cdf0e10cSrcweir                                                                  nFlags,
784cdf0e10cSrcweir                                                                  pInfo))
785cdf0e10cSrcweir                             continue;
786cdf0e10cSrcweir                         else
787cdf0e10cSrcweir                             break;
788cdf0e10cSrcweir                     }
789cdf0e10cSrcweir                 }
790cdf0e10cSrcweir             }
791cdf0e10cSrcweir         }
792cdf0e10cSrcweir 
793cdf0e10cSrcweir         if ( pEndDestBuf - pDestBuf < n )
794cdf0e10cSrcweir         {
795cdf0e10cSrcweir             *pInfo |= RTL_UNICODETOTEXT_INFO_ERROR | RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL;
796cdf0e10cSrcweir             break;
797cdf0e10cSrcweir         }
798cdf0e10cSrcweir 
799cdf0e10cSrcweir         for ( i = 0; i < n; ++i )
800cdf0e10cSrcweir             *pDestBuf++ = aTempBuf[i];
801cdf0e10cSrcweir         pSrcBuf++;
802cdf0e10cSrcweir     }
803cdf0e10cSrcweir 
804cdf0e10cSrcweir     *pSrcCvtChars = nSrcChars - (pEndSrcBuf-pSrcBuf);
805cdf0e10cSrcweir     return (nDestBytes - (pEndDestBuf-pDestBuf));
806cdf0e10cSrcweir }
807