mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 22:04:36 +00:00
Fix for 65685; /r=valeski, /sr=ftang
This commit is contained in:
parent
d38f4cde87
commit
f6972dcca3
72
intl/uconv/src/8859-1.uf
Normal file
72
intl/uconv/src/8859-1.uf
Normal file
@ -0,0 +1,72 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
/*========================================================
|
||||
This is a Generated file. Please don't edit it.
|
||||
|
||||
The tool which used to generate this file is called fromu.
|
||||
If you have any problem of this file. Please contact
|
||||
Netscape Client International Team or
|
||||
ftang@netscape <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0000
|
||||
srcEnd = 007E
|
||||
destBegin = 0000
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 0
|
||||
srcBegin = 00A0
|
||||
srcEnd = 00FF
|
||||
destBegin = 00A0
|
||||
End of Item 0001
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0002,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0005,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x000B,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0002 */
|
||||
/* Total of Format 1 : 0x0000 */
|
||||
/* Total of Format 2 : 0x0000 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0000,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0005 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x007E, 0x0000,
|
||||
/* 0001 */ 0x00A0, 0x00FF, 0x00A0,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x000B Start of MappingTable */
|
||||
|
||||
/* End of table Total Length = 0x000B * 2 */
|
72
intl/uconv/src/8859-1.ut
Normal file
72
intl/uconv/src/8859-1.ut
Normal file
@ -0,0 +1,72 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
/*========================================================
|
||||
This is a Generated file. Please don't edit it.
|
||||
|
||||
The tool which used to generate this file is called fromu.
|
||||
If you have any problem of this file. Please contact
|
||||
Netscape Client International Team or
|
||||
ftang@netscape <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0000
|
||||
srcEnd = 007E
|
||||
destBegin = 0000
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 0
|
||||
srcBegin = 00A0
|
||||
srcEnd = 00FF
|
||||
destBegin = 00A0
|
||||
End of Item 0001
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0002,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0005,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x000B,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0002 */
|
||||
/* Total of Format 1 : 0x0000 */
|
||||
/* Total of Format 2 : 0x0000 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0000,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0005 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x007E, 0x0000,
|
||||
/* 0001 */ 0x00A0, 0x00FF, 0x00A0,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x000B Start of MappingTable */
|
||||
|
||||
/* End of table Total Length = 0x000B * 2 */
|
158
intl/uconv/src/cp1252.uf
Normal file
158
intl/uconv/src/cp1252.uf
Normal file
@ -0,0 +1,158 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
/*========================================================
|
||||
This is a Generated file. Please don't edit it.
|
||||
|
||||
The tool which used to generate this file is called fromu.
|
||||
If you have any problem of this file. Please contact
|
||||
Netscape Client International Team or
|
||||
ftang@netscape <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0000
|
||||
srcEnd = 007F
|
||||
destBegin = 0000
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 0
|
||||
srcBegin = 00A0
|
||||
srcEnd = 00FF
|
||||
destBegin = 00A0
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 1
|
||||
srcBegin = 0152
|
||||
srcEnd = 0153
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
008C 009C
|
||||
End of Item 0002
|
||||
|
||||
Begin of Item 0003
|
||||
Format 1
|
||||
srcBegin = 0160
|
||||
srcEnd = 0161
|
||||
mappingOffset = 0002
|
||||
Mapping =
|
||||
008A 009A
|
||||
End of Item 0003
|
||||
|
||||
Begin of Item 0004
|
||||
Format 1
|
||||
srcBegin = 0178
|
||||
srcEnd = 017E
|
||||
mappingOffset = 0004
|
||||
Mapping =
|
||||
009F FFFD FFFD FFFD FFFD 008E 009E
|
||||
End of Item 0004
|
||||
|
||||
Begin of Item 0005
|
||||
Format 2
|
||||
srcBegin = 0192
|
||||
destBegin = 0083
|
||||
End of Item 0005
|
||||
|
||||
Begin of Item 0006
|
||||
Format 2
|
||||
srcBegin = 02C6
|
||||
destBegin = 0088
|
||||
End of Item 0006
|
||||
|
||||
Begin of Item 0007
|
||||
Format 2
|
||||
srcBegin = 02DC
|
||||
destBegin = 0098
|
||||
End of Item 0007
|
||||
|
||||
Begin of Item 0008
|
||||
Format 1
|
||||
srcBegin = 2013
|
||||
srcEnd = 203A
|
||||
mappingOffset = 000B
|
||||
Mapping =
|
||||
0096 0097 FFFD FFFD FFFD 0091 0092 0082
|
||||
FFFD 0093 0094 0084 FFFD 0086 0087 0095
|
||||
FFFD FFFD FFFD 0085 FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD 0089 FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD 008B 009B
|
||||
End of Item 0008
|
||||
|
||||
Begin of Item 0009
|
||||
Format 2
|
||||
srcBegin = 20AC
|
||||
destBegin = 0080
|
||||
End of Item 0009
|
||||
|
||||
Begin of Item 000A
|
||||
Format 2
|
||||
srcBegin = 2122
|
||||
destBegin = 0099
|
||||
End of Item 000A
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x000B,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0007,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x0028,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0002 */
|
||||
/* Total of Format 1 : 0x0004 */
|
||||
/* Total of Format 2 : 0x0005 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x1100, 0x2221, 0x0221,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0007 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x007F, 0x0000,
|
||||
/* 0001 */ 0x00A0, 0x00FF, 0x00A0,
|
||||
/* 0002 */ 0x0152, 0x0153, 0x0000,
|
||||
/* 0003 */ 0x0160, 0x0161, 0x0002,
|
||||
/* 0004 */ 0x0178, 0x017E, 0x0004,
|
||||
/* 0005 */ 0x0192, 0x0000, 0x0083,
|
||||
/* 0006 */ 0x02C6, 0x0000, 0x0088,
|
||||
/* 0007 */ 0x02DC, 0x0000, 0x0098,
|
||||
/* 0008 */ 0x2013, 0x203A, 0x000B,
|
||||
/* 0009 */ 0x20AC, 0x0000, 0x0080,
|
||||
/* 000A */ 0x2122, 0x0000, 0x0099,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0028 Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x008C, 0x009C, 0x008A, 0x009A, 0x009F, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0008 */ 0xFFFD, 0x008E, 0x009E, 0x0096, 0x0097, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0010 */ 0x0091, 0x0092, 0x0082, 0xFFFD, 0x0093, 0x0094, 0x0084, 0xFFFD,
|
||||
/* 0018 */ 0x0086, 0x0087, 0x0095, 0xFFFD, 0xFFFD, 0xFFFD, 0x0085, 0xFFFD,
|
||||
/* 0020 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0028 */ 0x0089, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0030 */ 0xFFFD, 0x008B, 0x009B,
|
||||
/* End of table Total Length = 0x005B * 2 */
|
89
intl/uconv/src/cp1252.ut
Normal file
89
intl/uconv/src/cp1252.ut
Normal file
@ -0,0 +1,89 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
/*========================================================
|
||||
This is a Generated file. Please don't edit it.
|
||||
|
||||
The tool which used to generate this file is called fromu.
|
||||
If you have any problem of this file. Please contact
|
||||
Netscape Client International Team or
|
||||
ftang@netscape <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0000
|
||||
srcEnd = 007F
|
||||
destBegin = 0000
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 0
|
||||
srcBegin = 00A0
|
||||
srcEnd = 00FF
|
||||
destBegin = 00A0
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 1
|
||||
srcBegin = 0080
|
||||
srcEnd = 009F
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
20AC FFFD 201A 0192 201E 2026 2020 2021
|
||||
02C6 2030 0160 2039 0152 FFFD 017D FFFD
|
||||
FFFD 2018 2019 201C 201D 2022 2013 2014
|
||||
02DC 2122 0161 203A 0153 FFFD 017E 0178
|
||||
End of Item 0002
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0003,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0005,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x000E,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0002 */
|
||||
/* Total of Format 1 : 0x0001 */
|
||||
/* Total of Format 2 : 0x0000 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0100,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0005 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x007F, 0x0000,
|
||||
/* 0001 */ 0x00A0, 0x00FF, 0x00A0,
|
||||
/* 0002 */ 0x0080, 0x009F, 0x0000,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x000E Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
/* 0008 */ 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0x017D, 0xFFFD,
|
||||
/* 0010 */ 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
/* 0018 */ 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0xFFFD, 0x017E, 0x0178,
|
||||
/* End of table Total Length = 0x002E * 2 */
|
262
intl/uconv/src/macroman.uf
Normal file
262
intl/uconv/src/macroman.uf
Normal file
@ -0,0 +1,262 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
/*========================================================
|
||||
This is a Generated file. Please don't edit it.
|
||||
|
||||
The tool which used to generate this file is called fromu.
|
||||
If you have any problem of this file. Please contact
|
||||
Netscape Client International Team or
|
||||
ftang@netscape <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0000
|
||||
srcEnd = 007E
|
||||
destBegin = 0000
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 1
|
||||
srcBegin = 00A0
|
||||
srcEnd = 00FF
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
00CA 00C1 00A2 00A3 FFFD 00B4 FFFD 00A4
|
||||
00AC 00A9 00BB 00C7 00C2 FFFD 00A8 00F8
|
||||
00A1 00B1 FFFD FFFD 00AB 00B5 00A6 00E1
|
||||
00FC FFFD 00BC 00C8 FFFD FFFD FFFD 00C0
|
||||
00CB 00E7 00E5 00CC 0080 0081 00AE 0082
|
||||
00E9 0083 00E6 00E8 00ED 00EA 00EB 00EC
|
||||
FFFD 0084 00F1 00EE 00EF 00CD 0085 FFFD
|
||||
00AF 00F4 00F2 00F3 0086 FFFD FFFD 00A7
|
||||
0088 0087 0089 008B 008A 008C 00BE 008D
|
||||
008F 008E 0090 0091 0093 0092 0094 0095
|
||||
FFFD 0096 0098 0097 0099 009B 009A 00D6
|
||||
00BF 009D 009C 009E 009F FFFD FFFD 00D8
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 2
|
||||
srcBegin = 0131
|
||||
destBegin = 00F5
|
||||
End of Item 0002
|
||||
|
||||
Begin of Item 0003
|
||||
Format 1
|
||||
srcBegin = 0152
|
||||
srcEnd = 0153
|
||||
mappingOffset = 0060
|
||||
Mapping =
|
||||
00CE 00CF
|
||||
End of Item 0003
|
||||
|
||||
Begin of Item 0004
|
||||
Format 2
|
||||
srcBegin = 0178
|
||||
destBegin = 00D9
|
||||
End of Item 0004
|
||||
|
||||
Begin of Item 0005
|
||||
Format 2
|
||||
srcBegin = 0192
|
||||
destBegin = 00C4
|
||||
End of Item 0005
|
||||
|
||||
Begin of Item 0006
|
||||
Format 1
|
||||
srcBegin = 02C6
|
||||
srcEnd = 02C7
|
||||
mappingOffset = 0062
|
||||
Mapping =
|
||||
00F6 00FF
|
||||
End of Item 0006
|
||||
|
||||
Begin of Item 0007
|
||||
Format 1
|
||||
srcBegin = 02D8
|
||||
srcEnd = 02DD
|
||||
mappingOffset = 0064
|
||||
Mapping =
|
||||
00F9 00FA 00FB 00FE 00F7 00FD
|
||||
End of Item 0007
|
||||
|
||||
Begin of Item 0008
|
||||
Format 2
|
||||
srcBegin = 03C0
|
||||
destBegin = 00B9
|
||||
End of Item 0008
|
||||
|
||||
Begin of Item 0009
|
||||
Format 1
|
||||
srcBegin = 2013
|
||||
srcEnd = 2044
|
||||
mappingOffset = 006A
|
||||
Mapping =
|
||||
00D0 00D1 FFFD FFFD FFFD 00D4 00D5 00E2
|
||||
FFFD 00D2 00D3 00E3 FFFD 00A0 00E0 00A5
|
||||
FFFD FFFD FFFD 00C9 FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD 00E4 FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD 00DC 00DD
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD FFFD FFFD
|
||||
FFFD 00DA
|
||||
End of Item 0009
|
||||
|
||||
Begin of Item 000A
|
||||
Format 2
|
||||
srcBegin = 20AC
|
||||
destBegin = 00DB
|
||||
End of Item 000A
|
||||
|
||||
Begin of Item 000B
|
||||
Format 1
|
||||
srcBegin = 2122
|
||||
srcEnd = 2126
|
||||
mappingOffset = 009C
|
||||
Mapping =
|
||||
00AA FFFD FFFD FFFD 00BD
|
||||
End of Item 000B
|
||||
|
||||
Begin of Item 000C
|
||||
Format 1
|
||||
srcBegin = 2202
|
||||
srcEnd = 221E
|
||||
mappingOffset = 00A1
|
||||
Mapping =
|
||||
00B6 FFFD FFFD FFFD 00C6 FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD 00B8 FFFD 00B7
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD FFFD FFFD
|
||||
00C3 FFFD FFFD FFFD 00B0
|
||||
End of Item 000C
|
||||
|
||||
Begin of Item 000D
|
||||
Format 2
|
||||
srcBegin = 222B
|
||||
destBegin = 00BA
|
||||
End of Item 000D
|
||||
|
||||
Begin of Item 000E
|
||||
Format 2
|
||||
srcBegin = 2248
|
||||
destBegin = 00C5
|
||||
End of Item 000E
|
||||
|
||||
Begin of Item 000F
|
||||
Format 1
|
||||
srcBegin = 2260
|
||||
srcEnd = 2265
|
||||
mappingOffset = 00BE
|
||||
Mapping =
|
||||
00AD FFFD FFFD FFFD 00B2 00B3
|
||||
End of Item 000F
|
||||
|
||||
Begin of Item 0010
|
||||
Format 2
|
||||
srcBegin = 25CA
|
||||
destBegin = 00D7
|
||||
End of Item 0010
|
||||
|
||||
Begin of Item 0011
|
||||
Format 2
|
||||
srcBegin = F8FF
|
||||
destBegin = 00F0
|
||||
End of Item 0011
|
||||
|
||||
Begin of Item 0012
|
||||
Format 1
|
||||
srcBegin = FB01
|
||||
srcEnd = FB02
|
||||
mappingOffset = 00C4
|
||||
Mapping =
|
||||
00DE 00DF
|
||||
End of Item 0012
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0013,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0009,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x0042,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0001 */
|
||||
/* Total of Format 1 : 0x0009 */
|
||||
/* Total of Format 2 : 0x0009 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x1210, 0x1122, 0x1212, 0x1221, 0x0122,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0009 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x007E, 0x0000,
|
||||
/* 0001 */ 0x00A0, 0x00FF, 0x0000,
|
||||
/* 0002 */ 0x0131, 0x0000, 0x00F5,
|
||||
/* 0003 */ 0x0152, 0x0153, 0x0060,
|
||||
/* 0004 */ 0x0178, 0x0000, 0x00D9,
|
||||
/* 0005 */ 0x0192, 0x0000, 0x00C4,
|
||||
/* 0006 */ 0x02C6, 0x02C7, 0x0062,
|
||||
/* 0007 */ 0x02D8, 0x02DD, 0x0064,
|
||||
/* 0008 */ 0x03C0, 0x0000, 0x00B9,
|
||||
/* 0009 */ 0x2013, 0x2044, 0x006A,
|
||||
/* 000A */ 0x20AC, 0x0000, 0x00DB,
|
||||
/* 000B */ 0x2122, 0x2126, 0x009C,
|
||||
/* 000C */ 0x2202, 0x221E, 0x00A1,
|
||||
/* 000D */ 0x222B, 0x0000, 0x00BA,
|
||||
/* 000E */ 0x2248, 0x0000, 0x00C5,
|
||||
/* 000F */ 0x2260, 0x2265, 0x00BE,
|
||||
/* 0010 */ 0x25CA, 0x0000, 0x00D7,
|
||||
/* 0011 */ 0xF8FF, 0x0000, 0x00F0,
|
||||
/* 0012 */ 0xFB01, 0xFB02, 0x00C4,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0042 Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x00CA, 0x00C1, 0x00A2, 0x00A3, 0xFFFD, 0x00B4, 0xFFFD, 0x00A4,
|
||||
/* 0008 */ 0x00AC, 0x00A9, 0x00BB, 0x00C7, 0x00C2, 0xFFFD, 0x00A8, 0x00F8,
|
||||
/* 0010 */ 0x00A1, 0x00B1, 0xFFFD, 0xFFFD, 0x00AB, 0x00B5, 0x00A6, 0x00E1,
|
||||
/* 0018 */ 0x00FC, 0xFFFD, 0x00BC, 0x00C8, 0xFFFD, 0xFFFD, 0xFFFD, 0x00C0,
|
||||
/* 0020 */ 0x00CB, 0x00E7, 0x00E5, 0x00CC, 0x0080, 0x0081, 0x00AE, 0x0082,
|
||||
/* 0028 */ 0x00E9, 0x0083, 0x00E6, 0x00E8, 0x00ED, 0x00EA, 0x00EB, 0x00EC,
|
||||
/* 0030 */ 0xFFFD, 0x0084, 0x00F1, 0x00EE, 0x00EF, 0x00CD, 0x0085, 0xFFFD,
|
||||
/* 0038 */ 0x00AF, 0x00F4, 0x00F2, 0x00F3, 0x0086, 0xFFFD, 0xFFFD, 0x00A7,
|
||||
/* 0040 */ 0x0088, 0x0087, 0x0089, 0x008B, 0x008A, 0x008C, 0x00BE, 0x008D,
|
||||
/* 0048 */ 0x008F, 0x008E, 0x0090, 0x0091, 0x0093, 0x0092, 0x0094, 0x0095,
|
||||
/* 0050 */ 0xFFFD, 0x0096, 0x0098, 0x0097, 0x0099, 0x009B, 0x009A, 0x00D6,
|
||||
/* 0058 */ 0x00BF, 0x009D, 0x009C, 0x009E, 0x009F, 0xFFFD, 0xFFFD, 0x00D8,
|
||||
/* 0060 */ 0x00CE, 0x00CF, 0x00F6, 0x00FF, 0x00F9, 0x00FA, 0x00FB, 0x00FE,
|
||||
/* 0068 */ 0x00F7, 0x00FD, 0x00D0, 0x00D1, 0xFFFD, 0xFFFD, 0xFFFD, 0x00D4,
|
||||
/* 0070 */ 0x00D5, 0x00E2, 0xFFFD, 0x00D2, 0x00D3, 0x00E3, 0xFFFD, 0x00A0,
|
||||
/* 0078 */ 0x00E0, 0x00A5, 0xFFFD, 0xFFFD, 0xFFFD, 0x00C9, 0xFFFD, 0xFFFD,
|
||||
/* 0080 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00E4,
|
||||
/* 0088 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0090 */ 0x00DC, 0x00DD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0098 */ 0xFFFD, 0xFFFD, 0xFFFD, 0x00DA, 0x00AA, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 00A0 */ 0x00BD, 0x00B6, 0xFFFD, 0xFFFD, 0xFFFD, 0x00C6, 0xFFFD, 0xFFFD,
|
||||
/* 00A8 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00B8, 0xFFFD,
|
||||
/* 00B0 */ 0x00B7, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 00B8 */ 0xFFFD, 0x00C3, 0xFFFD, 0xFFFD, 0xFFFD, 0x00B0, 0x00AD, 0xFFFD,
|
||||
/* 00C0 */ 0xFFFD, 0xFFFD, 0x00B2, 0x00B3, 0x00DE, 0x00DF,
|
||||
/* End of table Total Length = 0x0108 * 2 */
|
105
intl/uconv/src/macroman.ut
Normal file
105
intl/uconv/src/macroman.ut
Normal file
@ -0,0 +1,105 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
/*========================================================
|
||||
This is a Generated file. Please don't edit it.
|
||||
|
||||
The tool which used to generate this file is called fromu.
|
||||
If you have any problem of this file. Please contact
|
||||
Netscape Client International Team or
|
||||
ftang@netscape <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0000
|
||||
srcEnd = 007E
|
||||
destBegin = 0000
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 1
|
||||
srcBegin = 0080
|
||||
srcEnd = 00FF
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1
|
||||
00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8
|
||||
00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3
|
||||
00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC
|
||||
2020 00B0 00A2 00A3 00A7 2022 00B6 00DF
|
||||
00AE 00A9 2122 00B4 00A8 2260 00C6 00D8
|
||||
221E 00B1 2264 2265 00A5 00B5 2202 2211
|
||||
220F 03C0 222B 00AA 00BA 2126 00E6 00F8
|
||||
00BF 00A1 00AC 221A 0192 2248 2206 00AB
|
||||
00BB 2026 00A0 00C0 00C3 00D5 0152 0153
|
||||
2013 2014 201C 201D 2018 2019 00F7 25CA
|
||||
00FF 0178 2044 20AC 2039 203A FB01 FB02
|
||||
2021 00B7 201A 201E 2030 00C2 00CA 00C1
|
||||
00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4
|
||||
F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC
|
||||
00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7
|
||||
End of Item 0001
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0002,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0005,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x000B,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0001 */
|
||||
/* Total of Format 1 : 0x0001 */
|
||||
/* Total of Format 2 : 0x0000 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0010,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0005 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x007E, 0x0000,
|
||||
/* 0001 */ 0x0080, 0x00FF, 0x0000,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x000B Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1,
|
||||
/* 0008 */ 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8,
|
||||
/* 0010 */ 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3,
|
||||
/* 0018 */ 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC,
|
||||
/* 0020 */ 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF,
|
||||
/* 0028 */ 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8,
|
||||
/* 0030 */ 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211,
|
||||
/* 0038 */ 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x2126, 0x00E6, 0x00F8,
|
||||
/* 0040 */ 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB,
|
||||
/* 0048 */ 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153,
|
||||
/* 0050 */ 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA,
|
||||
/* 0058 */ 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0xFB01, 0xFB02,
|
||||
/* 0060 */ 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1,
|
||||
/* 0068 */ 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4,
|
||||
/* 0070 */ 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC,
|
||||
/* 0078 */ 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7,
|
||||
/* End of table Total Length = 0x008B * 2 */
|
70
intl/uconv/src/nsCP1252ToUnicode.cpp
Normal file
70
intl/uconv/src/nsCP1252ToUnicode.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsUCvMinSupport.h"
|
||||
#include "nsCP1252ToUnicode.h"
|
||||
|
||||
NS_IMETHODIMP NS_NewCP1252ToUnicode(nsISupports* aOuter,
|
||||
const nsIID& aIID,
|
||||
void** aResult)
|
||||
{
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsCP1252ToUnicode * inst = new nsCP1252ToUnicode();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static PRUint16 g_utMappingTable[] = {
|
||||
#include "cp1252.ut"
|
||||
};
|
||||
|
||||
static PRInt16 g_utShiftTable[] = {
|
||||
0, u1ByteCharset ,
|
||||
ShiftCell(0,0,0,0,0,0,0,0)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsCP1252ToUnicode [implementation]
|
||||
|
||||
nsCP1252ToUnicode::nsCP1252ToUnicode()
|
||||
: nsOneByteDecoderSupport((uShiftTable*) &g_utShiftTable,
|
||||
(uMappingTable*) &g_utMappingTable)
|
||||
{
|
||||
}
|
55
intl/uconv/src/nsCP1252ToUnicode.h
Normal file
55
intl/uconv/src/nsCP1252ToUnicode.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsCP1252ToUnicode_h___
|
||||
#define nsCP1252ToUnicode_h___
|
||||
|
||||
// Class ID for our CP1252ToUnicode charset converter
|
||||
// {7C657D15-EC5E-11d2-8AAC-00600811A836}
|
||||
NS_DECLARE_ID(kCP1252ToUnicodeCID,
|
||||
0x7c657d15, 0xec5e, 0x11d2, 0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
|
||||
#define NS_CP1252TOUNICODE_CID \
|
||||
{ 0x7c657d15, 0xec5e, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_CP1252TOUNICODE_CONTRACTID "@mozilla.org/intl/unicode/decoder;1?charset=windows-1252"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsCP1252ToUnicode [declaration]
|
||||
|
||||
/**
|
||||
* A character set converter from CP1252 to Unicode.
|
||||
*
|
||||
* @created 20/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsCP1252ToUnicode : public nsOneByteDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsCP1252ToUnicode();
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsCP1252ToUnicode_h___ */
|
70
intl/uconv/src/nsISO88591ToUnicode.cpp
Normal file
70
intl/uconv/src/nsISO88591ToUnicode.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsUCvMinSupport.h"
|
||||
#include "nsISO88591ToUnicode.h"
|
||||
|
||||
NS_IMETHODIMP NS_NewISO88591ToUnicode(nsISupports* aOuter,
|
||||
const nsIID& aIID,
|
||||
void** aResult)
|
||||
{
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsISO88591ToUnicode * inst = new nsISO88591ToUnicode();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static PRUint16 g_utMappingTable[] = {
|
||||
#include "cp1252.ut"
|
||||
};
|
||||
|
||||
static PRInt16 g_utShiftTable[] = {
|
||||
0, u1ByteCharset ,
|
||||
ShiftCell(0,0,0,0,0,0,0,0)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsISO88591ToUnicode [implementation]
|
||||
|
||||
nsISO88591ToUnicode::nsISO88591ToUnicode()
|
||||
: nsOneByteDecoderSupport((uShiftTable*) &g_utShiftTable,
|
||||
(uMappingTable*) &g_utMappingTable)
|
||||
{
|
||||
}
|
||||
|
55
intl/uconv/src/nsISO88591ToUnicode.h
Normal file
55
intl/uconv/src/nsISO88591ToUnicode.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsISO88591ToUnicode_h___
|
||||
#define nsISO88591ToUnicode_h___
|
||||
|
||||
// Class ID for our ISO88591ToUnicode charset converter
|
||||
// {A3254CB0-8E20-11d2-8A98-00600811A836}
|
||||
NS_DECLARE_ID(kISO88591ToUnicodeCID,
|
||||
0xa3254cb0, 0x8e20, 0x11d2, 0x8a, 0x98, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
|
||||
#define NS_ISO88591TOUNICODE_CID \
|
||||
{ 0xa3254cb0, 0x8e20, 0x11d2, {0x8a, 0x98, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_ISO88591TOUNICODE_CONTRACTID "@mozilla.org/intl/unicode/decoder;1?charset=ISO-8859-1"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsISO88591ToUnicode [declaration]
|
||||
|
||||
/**
|
||||
* A character set converter from ISO88591 to Unicode.
|
||||
*
|
||||
* @created 23/Nov/1998
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsISO88591ToUnicode : public nsOneByteDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsISO88591ToUnicode();
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsISO88591ToUnicode_h___ */
|
81
intl/uconv/src/nsMacRomanToUnicode.cpp
Normal file
81
intl/uconv/src/nsMacRomanToUnicode.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsUCvMinSupport.h"
|
||||
#include "nsMacRomanToUnicode.h"
|
||||
|
||||
NS_IMETHODIMP NS_NewMacRomanToUnicode(nsISupports* aOuter,
|
||||
const nsIID& aIID,
|
||||
void** aResult)
|
||||
{
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsMacRomanToUnicode * inst = new nsMacRomanToUnicode();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static PRUint16 g_MacRomanMappingTable[] = {
|
||||
#include "macroman.ut"
|
||||
};
|
||||
|
||||
static PRInt16 g_MacRomanShiftTable[] = {
|
||||
1, u1ByteCharset ,
|
||||
ShiftCell(0,0,0,0,0,0,0,0)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsMacRomanToUnicode [implementation]
|
||||
|
||||
nsMacRomanToUnicode::nsMacRomanToUnicode()
|
||||
: nsTableDecoderSupport((uShiftTable*) &g_MacRomanShiftTable,
|
||||
(uMappingTable*) &g_MacRomanMappingTable)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsTableDecoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsMacRomanToUnicode::GetMaxLength(const char * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
// we are a single byte to Unicode converter, so...
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK_UDEC_EXACTLENGTH;
|
||||
}
|
65
intl/uconv/src/nsMacRomanToUnicode.h
Normal file
65
intl/uconv/src/nsMacRomanToUnicode.h
Normal file
@ -0,0 +1,65 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsMacRomanToUnicode_h___
|
||||
#define nsMacRomanToUnicode_h___
|
||||
|
||||
// Class ID for our MacRomanToUnicode charset converter
|
||||
// {7B8556A1-EC79-11d2-8AAC-00600811A836}
|
||||
NS_DECLARE_ID(kMacRomanToUnicodeCID,
|
||||
0x7b8556a1, 0xec79, 0x11d2, 0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
|
||||
#define NS_MACROMANTOUNICODE_CID \
|
||||
{ 0x7b8556a1, 0xec79, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_MACROMANTOUNICODE_CONTRACTID "@mozilla.org/intl/unicode/decoder;1?charset=x-mac-roman"
|
||||
|
||||
//#define NS_ERROR_UCONV_NOMACROMANTOUNICODE \
|
||||
// NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x31)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsMacRomanToUnicode [declaration]
|
||||
|
||||
/**
|
||||
* A character set converter from MacRoman to Unicode.
|
||||
*
|
||||
* @created 05/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsMacRomanToUnicode : public nsTableDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsMacRomanToUnicode();
|
||||
|
||||
protected:
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsDecoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD GetMaxLength(const char * aSrc, PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength);
|
||||
};
|
||||
|
||||
#endif /* nsMacRomanToUnicode_h___ */
|
31
intl/uconv/src/nsUCvMinDll.h
Normal file
31
intl/uconv/src/nsUCvMinDll.h
Normal file
@ -0,0 +1,31 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsUCvMinDll_h___
|
||||
#define nsUCvMinDll_h___
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
extern PRInt32 g_InstanceCount;
|
||||
extern PRInt32 g_LockCount;
|
||||
|
||||
#endif /* nsUCvMinDll_h___ */
|
710
intl/uconv/src/nsUCvMinSupport.cpp
Normal file
710
intl/uconv/src/nsUCvMinSupport.cpp
Normal file
@ -0,0 +1,710 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#include "pratom.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsICharRepresentable.h"
|
||||
#include "nsUCvMinSupport.h"
|
||||
#include "nsUConvDll.h"
|
||||
|
||||
#define DEFAULT_BUFFER_CAPACITY 16
|
||||
|
||||
// XXX review the buffer growth limitation code
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicDecoderSupport [implementation]
|
||||
|
||||
nsBasicDecoderSupport::nsBasicDecoderSupport()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsBasicDecoderSupport::~nsBasicDecoderSupport()
|
||||
{
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsISupports [implementation]
|
||||
|
||||
NS_IMPL_ADDREF(nsBasicDecoderSupport);
|
||||
NS_IMPL_RELEASE(nsBasicDecoderSupport);
|
||||
|
||||
nsresult nsBasicDecoderSupport::QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIUnicodeDecoder))) {
|
||||
*aInstancePtr = (void*) ((nsIUnicodeDecoder*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsIUnicodeDecoder [implementation]
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBufferDecoderSupport [implementation]
|
||||
|
||||
nsBufferDecoderSupport::nsBufferDecoderSupport()
|
||||
: nsBasicDecoderSupport()
|
||||
{
|
||||
mBufferCapacity = DEFAULT_BUFFER_CAPACITY;
|
||||
mBuffer = new char[mBufferCapacity];
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
nsBufferDecoderSupport::~nsBufferDecoderSupport()
|
||||
{
|
||||
delete [] mBuffer;
|
||||
}
|
||||
|
||||
void nsBufferDecoderSupport::FillBuffer(const char ** aSrc, PRInt32 aSrcLength)
|
||||
{
|
||||
PRInt32 bcr = PR_MIN(mBufferCapacity - mBufferLength, aSrcLength);
|
||||
memcpy(mBuffer + mBufferLength, *aSrc, bcr);
|
||||
mBufferLength += bcr;
|
||||
(*aSrc) += bcr;
|
||||
}
|
||||
|
||||
void nsBufferDecoderSupport::DoubleBuffer()
|
||||
{
|
||||
mBufferCapacity *= 2;
|
||||
char * newBuffer = new char [mBufferCapacity];
|
||||
if (mBufferLength > 0) memcpy(newBuffer, mBuffer, mBufferLength);
|
||||
delete [] mBuffer;
|
||||
mBuffer = newBuffer;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsBasicDecoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsBufferDecoderSupport::Convert(const char * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
// we do all operations using pointers internally
|
||||
const char * src = aSrc;
|
||||
const char * srcEnd = aSrc + *aSrcLength;
|
||||
PRUnichar * dest = aDest;
|
||||
PRUnichar * destEnd = aDest + *aDestLength;
|
||||
|
||||
PRInt32 bcr, bcw; // byte counts for read & write;
|
||||
nsresult res = NS_OK;
|
||||
|
||||
// do we have some residual data from the last conversion?
|
||||
if (mBufferLength > 0) if (dest == destEnd) {
|
||||
res = NS_OK_UDEC_MOREOUTPUT;
|
||||
} else for (;;) {
|
||||
// we need new data to add to the buffer
|
||||
if (src == srcEnd) {
|
||||
res = NS_OK_UDEC_MOREINPUT;
|
||||
break;
|
||||
}
|
||||
|
||||
// fill that buffer
|
||||
PRInt32 buffLen = mBufferLength; // initial buffer length
|
||||
FillBuffer(&src, srcEnd - src);
|
||||
|
||||
// convert that buffer
|
||||
bcr = mBufferLength;
|
||||
bcw = destEnd - dest;
|
||||
res = ConvertNoBuff(mBuffer, &bcr, dest, &bcw);
|
||||
dest += bcw;
|
||||
|
||||
if ((res == NS_OK_UDEC_MOREINPUT) && (bcw == 0)) {
|
||||
res = NS_ERROR_UNEXPECTED;
|
||||
break;
|
||||
} else {
|
||||
if (bcr < buffLen) {
|
||||
// we didn't convert that residual data - unfill the buffer
|
||||
src -= mBufferLength - buffLen;
|
||||
mBufferLength = buffLen;
|
||||
} else {
|
||||
// the buffer and some extra data was converted - unget the rest
|
||||
src -= mBufferLength - bcr;
|
||||
mBufferLength = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (res == NS_OK) {
|
||||
bcr = srcEnd - src;
|
||||
bcw = destEnd - dest;
|
||||
res = ConvertNoBuff(src, &bcr, dest, &bcw);
|
||||
src += bcr;
|
||||
dest += bcw;
|
||||
|
||||
// if we have partial input, store it in our internal buffer.
|
||||
if (res == NS_OK_UDEC_MOREINPUT) {
|
||||
bcr = srcEnd - src;
|
||||
// make sure buffer is large enough
|
||||
if (bcr > mBufferCapacity) {
|
||||
// somehow we got into an error state and the buffer is growing out of control
|
||||
res = NS_ERROR_UNEXPECTED;
|
||||
} else {
|
||||
FillBuffer(&src, bcr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*aSrcLength -= srcEnd - src;
|
||||
*aDestLength -= destEnd - dest;
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBufferDecoderSupport::Reset()
|
||||
{
|
||||
mBufferLength = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsTableDecoderSupport [implementation]
|
||||
|
||||
nsTableDecoderSupport::nsTableDecoderSupport(uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable)
|
||||
: nsBufferDecoderSupport()
|
||||
{
|
||||
mHelper = NULL;
|
||||
mShiftTable = aShiftTable;
|
||||
mMappingTable = aMappingTable;
|
||||
}
|
||||
|
||||
nsTableDecoderSupport::~nsTableDecoderSupport()
|
||||
{
|
||||
NS_IF_RELEASE(mHelper);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsBufferDecoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsTableDecoderSupport::ConvertNoBuff(const char * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeDecodeHelperCID, NULL,
|
||||
kIUnicodeDecodeHelperIID, (void**) & mHelper);
|
||||
|
||||
if (NS_FAILED(res)) return NS_ERROR_UDEC_NOHELPER;
|
||||
}
|
||||
|
||||
res = mHelper->ConvertByTable(aSrc, aSrcLength, aDest, aDestLength,
|
||||
mShiftTable, mMappingTable);
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsMultiTableDecoderSupport [implementation]
|
||||
|
||||
nsMultiTableDecoderSupport::nsMultiTableDecoderSupport(
|
||||
PRInt32 aTableCount,
|
||||
uRange * aRangeArray,
|
||||
uShiftTable ** aShiftTable,
|
||||
uMappingTable ** aMappingTable)
|
||||
: nsBufferDecoderSupport()
|
||||
{
|
||||
mHelper = NULL;
|
||||
mTableCount = aTableCount;
|
||||
mRangeArray = aRangeArray;
|
||||
mShiftTable = aShiftTable;
|
||||
mMappingTable = aMappingTable;
|
||||
}
|
||||
|
||||
nsMultiTableDecoderSupport::~nsMultiTableDecoderSupport()
|
||||
{
|
||||
NS_IF_RELEASE(mHelper);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsBufferDecoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsMultiTableDecoderSupport::ConvertNoBuff(const char * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeDecodeHelperCID, NULL,
|
||||
kIUnicodeDecodeHelperIID, (void**) &mHelper);
|
||||
|
||||
if (NS_FAILED(res)) return NS_ERROR_UDEC_NOHELPER;
|
||||
}
|
||||
|
||||
res = mHelper->ConvertByMultiTable(aSrc, aSrcLength, aDest, aDestLength,
|
||||
mTableCount, mRangeArray, mShiftTable, mMappingTable);
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsOneByteDecoderSupport [implementation]
|
||||
|
||||
nsOneByteDecoderSupport::nsOneByteDecoderSupport(
|
||||
uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable)
|
||||
: nsBasicDecoderSupport()
|
||||
{
|
||||
mHelper = NULL;
|
||||
mShiftTable = aShiftTable;
|
||||
mMappingTable = aMappingTable;
|
||||
}
|
||||
|
||||
nsOneByteDecoderSupport::~nsOneByteDecoderSupport()
|
||||
{
|
||||
NS_IF_RELEASE(mHelper);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsBasicDecoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsOneByteDecoderSupport::Convert(const char * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeDecodeHelperCID, NULL,
|
||||
kIUnicodeDecodeHelperIID, (void**) &mHelper);
|
||||
if (NS_FAILED(res)) return NS_ERROR_UDEC_NOHELPER;
|
||||
|
||||
res = mHelper -> CreateFastTable(mShiftTable, mMappingTable, mFastTable,
|
||||
ONE_BYTE_TABLE_SIZE);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
|
||||
res = mHelper->ConvertByFastTable(aSrc, aSrcLength, aDest, aDestLength,
|
||||
mFastTable, ONE_BYTE_TABLE_SIZE);
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOneByteDecoderSupport::GetMaxLength(const char * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
// single byte to Unicode converter
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK_UDEC_EXACTLENGTH;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOneByteDecoderSupport::Reset()
|
||||
{
|
||||
// nothing to reset, no internal state in this case
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicEncoder [implementation]
|
||||
nsBasicEncoder::nsBasicEncoder()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsBasicEncoder::~nsBasicEncoder()
|
||||
{
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsISupports [implementation]
|
||||
|
||||
NS_IMPL_ADDREF(nsBasicEncoder);
|
||||
NS_IMPL_RELEASE(nsBasicEncoder);
|
||||
|
||||
nsresult nsBasicEncoder::QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
if (aIID.Equals(kIUnicodeEncoderIID)) {
|
||||
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsICharRepresentable))) {
|
||||
*aInstancePtr = (void*) ((nsICharRepresentable*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)((nsIUnicodeEncoder*)this));
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncoderSupport [implementation]
|
||||
|
||||
nsEncoderSupport::nsEncoderSupport()
|
||||
{
|
||||
mBufferCapacity = DEFAULT_BUFFER_CAPACITY;
|
||||
mBuffer = new char[mBufferCapacity];
|
||||
|
||||
mErrBehavior = kOnError_Signal;
|
||||
mErrChar = 0;
|
||||
mErrEncoder = NULL;
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
nsEncoderSupport::~nsEncoderSupport()
|
||||
{
|
||||
delete [] mBuffer;
|
||||
NS_IF_RELEASE(mErrEncoder);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEncoderSupport::ConvertNoBuff(const PRUnichar * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
char * aDest,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
// we do all operations using pointers internally
|
||||
const PRUnichar * src = aSrc;
|
||||
const PRUnichar * srcEnd = aSrc + *aSrcLength;
|
||||
char * dest = aDest;
|
||||
char * destEnd = aDest + *aDestLength;
|
||||
|
||||
PRInt32 bcr, bcw; // byte counts for read & write;
|
||||
nsresult res;
|
||||
|
||||
for (;;) {
|
||||
bcr = srcEnd - src;
|
||||
bcw = destEnd - dest;
|
||||
res = ConvertNoBuffNoErr(src, &bcr, dest, &bcw);
|
||||
src += bcr;
|
||||
dest += bcw;
|
||||
|
||||
if (res == NS_ERROR_UENC_NOMAPPING) {
|
||||
if (mErrBehavior == kOnError_Replace) {
|
||||
const PRUnichar buff[] = {mErrChar};
|
||||
bcr = 1;
|
||||
bcw = destEnd - dest;
|
||||
src--; // back the input: maybe the guy won't consume consume anything.
|
||||
res = ConvertNoBuffNoErr(buff, &bcr, dest, &bcw);
|
||||
src += bcr;
|
||||
dest += bcw;
|
||||
if (res != NS_OK) break;
|
||||
} else if (mErrBehavior == kOnError_CallBack) {
|
||||
bcw = destEnd - dest;
|
||||
src--;
|
||||
res = mErrEncoder->Convert(*src, dest, &bcw);
|
||||
dest += bcw;
|
||||
// if enought output space then the last char was used
|
||||
if (res != NS_OK_UENC_MOREOUTPUT) src++;
|
||||
if (res != NS_OK) break;
|
||||
} else break;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
|
||||
*aSrcLength -= srcEnd - src;
|
||||
*aDestLength -= destEnd - dest;
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEncoderSupport::FinishNoBuff(char * aDest,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEncoderSupport::FlushBuffer(char ** aDest, const char * aDestEnd)
|
||||
{
|
||||
PRInt32 bcr, bcw; // byte counts for read & write;
|
||||
nsresult res = NS_OK;
|
||||
char * dest = *aDest;
|
||||
|
||||
if (mBufferStart < mBufferEnd) {
|
||||
bcr = mBufferEnd - mBufferStart;
|
||||
bcw = aDestEnd - dest;
|
||||
if (bcw < bcr) bcr = bcw;
|
||||
memcpy(dest, mBufferStart, bcr);
|
||||
dest += bcr;
|
||||
mBufferStart += bcr;
|
||||
|
||||
if (mBufferStart < mBufferEnd) res = NS_OK_UENC_MOREOUTPUT;
|
||||
}
|
||||
|
||||
*aDest = dest;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsIUnicodeEncoder [implementation]
|
||||
|
||||
NS_IMETHODIMP nsEncoderSupport::Convert(const PRUnichar * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
char * aDest,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
// we do all operations using pointers internally
|
||||
const PRUnichar * src = aSrc;
|
||||
const PRUnichar * srcEnd = aSrc + *aSrcLength;
|
||||
char * dest = aDest;
|
||||
char * destEnd = aDest + *aDestLength;
|
||||
|
||||
PRInt32 bcr, bcw; // byte counts for read & write;
|
||||
nsresult res;
|
||||
|
||||
res = FlushBuffer(&dest, destEnd);
|
||||
if (res == NS_OK_UENC_MOREOUTPUT) goto final;
|
||||
|
||||
bcr = srcEnd - src;
|
||||
bcw = destEnd - dest;
|
||||
res = ConvertNoBuff(src, &bcr, dest, &bcw);
|
||||
src += bcr;
|
||||
dest += bcw;
|
||||
if ((res == NS_OK_UENC_MOREOUTPUT) && (dest < destEnd)) {
|
||||
// convert exactly one character into the internal buffer
|
||||
// at this point, there should be at least a char in the input
|
||||
for (;;) {
|
||||
bcr = 1;
|
||||
bcw = mBufferCapacity;
|
||||
res = ConvertNoBuff(src, &bcr, mBuffer, &bcw);
|
||||
|
||||
if (res == NS_OK_UENC_MOREOUTPUT) {
|
||||
delete [] mBuffer;
|
||||
mBufferCapacity *= 2;
|
||||
mBuffer = new char [mBufferCapacity];
|
||||
} else {
|
||||
src += bcr;
|
||||
mBufferStart = mBufferEnd = mBuffer;
|
||||
mBufferEnd += bcw;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
res = FlushBuffer(&dest, destEnd);
|
||||
}
|
||||
|
||||
final:
|
||||
*aSrcLength -= srcEnd - src;
|
||||
*aDestLength -= destEnd - dest;
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEncoderSupport::Finish(char * aDest, PRInt32 * aDestLength)
|
||||
{
|
||||
// we do all operations using pointers internally
|
||||
char * dest = aDest;
|
||||
char * destEnd = aDest + *aDestLength;
|
||||
|
||||
PRInt32 bcw; // byte count for write;
|
||||
nsresult res;
|
||||
|
||||
res = FlushBuffer(&dest, destEnd);
|
||||
if (res == NS_OK_UENC_MOREOUTPUT) goto final;
|
||||
|
||||
// do the finish into the internal buffer.
|
||||
for (;;) {
|
||||
bcw = mBufferCapacity;
|
||||
res = FinishNoBuff(mBuffer, &bcw);
|
||||
|
||||
if (res == NS_OK_UENC_MOREOUTPUT) {
|
||||
delete [] mBuffer;
|
||||
mBufferCapacity *= 2;
|
||||
mBuffer = new char [mBufferCapacity];
|
||||
} else {
|
||||
mBufferStart = mBufferEnd = mBuffer;
|
||||
mBufferEnd += bcw;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
res = FlushBuffer(&dest, destEnd);
|
||||
|
||||
final:
|
||||
*aDestLength -= destEnd - dest;
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEncoderSupport::Reset()
|
||||
{
|
||||
mBufferStart = mBufferEnd = mBuffer;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEncoderSupport::SetOutputErrorBehavior(
|
||||
PRInt32 aBehavior,
|
||||
nsIUnicharEncoder * aEncoder,
|
||||
PRUnichar aChar)
|
||||
{
|
||||
if ((aBehavior == kOnError_CallBack) && (aEncoder == NULL))
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
NS_IF_RELEASE(aEncoder);
|
||||
mErrEncoder = aEncoder;
|
||||
NS_IF_ADDREF(aEncoder);
|
||||
|
||||
mErrBehavior = aBehavior;
|
||||
mErrChar = aChar;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsTableEncoderSupport [implementation]
|
||||
|
||||
nsTableEncoderSupport::nsTableEncoderSupport(uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable)
|
||||
: nsEncoderSupport()
|
||||
{
|
||||
mHelper = NULL;
|
||||
mShiftTable = aShiftTable;
|
||||
mMappingTable = aMappingTable;
|
||||
}
|
||||
|
||||
nsTableEncoderSupport::~nsTableEncoderSupport()
|
||||
{
|
||||
NS_IF_RELEASE(mHelper);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsTableEncoderSupport::FillInfo(PRUint32 *aInfo)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeEncodeHelperCID, NULL,
|
||||
kIUnicodeEncodeHelperIID, (void**) & mHelper);
|
||||
|
||||
if (NS_FAILED(res)) return NS_ERROR_UENC_NOHELPER;
|
||||
}
|
||||
|
||||
res = mHelper->FillInfo(aInfo, mMappingTable);
|
||||
return res;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsEncoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsTableEncoderSupport::ConvertNoBuffNoErr(
|
||||
const PRUnichar * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
char * aDest,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeEncodeHelperCID, NULL,
|
||||
kIUnicodeEncodeHelperIID, (void**) & mHelper);
|
||||
|
||||
if (NS_FAILED(res)) return NS_ERROR_UENC_NOHELPER;
|
||||
}
|
||||
|
||||
res = mHelper->ConvertByTable(aSrc, aSrcLength, aDest, aDestLength,
|
||||
mShiftTable, mMappingTable);
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsMultiTableEncoderSupport [implementation]
|
||||
|
||||
nsMultiTableEncoderSupport::nsMultiTableEncoderSupport(
|
||||
PRInt32 aTableCount,
|
||||
uShiftTable ** aShiftTable,
|
||||
uMappingTable ** aMappingTable)
|
||||
: nsEncoderSupport()
|
||||
{
|
||||
mHelper = NULL;
|
||||
mTableCount = aTableCount;
|
||||
mShiftTable = aShiftTable;
|
||||
mMappingTable = aMappingTable;
|
||||
}
|
||||
|
||||
nsMultiTableEncoderSupport::~nsMultiTableEncoderSupport()
|
||||
{
|
||||
NS_IF_RELEASE(mHelper);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMultiTableEncoderSupport::FillInfo(PRUint32 *aInfo)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeEncodeHelperCID, NULL,
|
||||
kIUnicodeEncodeHelperIID, (void**) & mHelper);
|
||||
|
||||
if (NS_FAILED(res)) return NS_ERROR_UENC_NOHELPER;
|
||||
}
|
||||
|
||||
res = mHelper->FillInfo(aInfo,mTableCount, mMappingTable);
|
||||
return res;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsEncoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsMultiTableEncoderSupport::ConvertNoBuffNoErr(
|
||||
const PRUnichar * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
char * aDest,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeEncodeHelperCID, NULL,
|
||||
kIUnicodeEncodeHelperIID, (void**) & mHelper);
|
||||
|
||||
if (NS_FAILED(res)) return NS_ERROR_UENC_NOHELPER;
|
||||
}
|
||||
|
||||
res = mHelper->ConvertByMultiTable(aSrc, aSrcLength, aDest, aDestLength,
|
||||
mTableCount, mShiftTable, mMappingTable);
|
||||
return res;
|
||||
}
|
417
intl/uconv/src/nsUCvMinSupport.h
Normal file
417
intl/uconv/src/nsUCvMinSupport.h
Normal file
@ -0,0 +1,417 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsUCvMinSupport_h___
|
||||
#define nsUCvMinSupport_h___
|
||||
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsIUnicodeEncodeHelper.h"
|
||||
#include "nsIUnicodeDecodeHelper.h"
|
||||
#include "nsICharRepresentable.h"
|
||||
|
||||
#define ONE_BYTE_TABLE_SIZE 256
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicDecoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for the Unicode decoders.
|
||||
*
|
||||
* This class implements:
|
||||
* - nsISupports
|
||||
* - nsIUnicodeDecoder
|
||||
*
|
||||
* @created 19/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsBasicDecoderSupport : public nsIUnicodeDecoder
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsBasicDecoderSupport();
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsBasicDecoderSupport();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Interface nsIUnicodeDecoder [declaration]
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBufferDecoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for the Unicode decoders.
|
||||
*
|
||||
* This class implements:
|
||||
* - the buffer management
|
||||
*
|
||||
* @created 15/Mar/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsBufferDecoderSupport : public nsBasicDecoderSupport
|
||||
{
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Internal buffer for partial conversions.
|
||||
*/
|
||||
char * mBuffer;
|
||||
PRInt32 mBufferCapacity;
|
||||
PRInt32 mBufferLength;
|
||||
|
||||
/**
|
||||
* Convert method but *without* the buffer management stuff.
|
||||
*/
|
||||
NS_IMETHOD ConvertNoBuff(const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength) = 0;
|
||||
|
||||
void FillBuffer(const char ** aSrc, PRInt32 aSrcLength);
|
||||
void DoubleBuffer();
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsBufferDecoderSupport();
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsBufferDecoderSupport();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Interface nsIUnicodeDecoder [declaration]
|
||||
|
||||
NS_IMETHOD Convert(const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength);
|
||||
NS_IMETHOD Reset();
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsTableDecoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for a single-table-driven Unicode decoder.
|
||||
*
|
||||
* @created 15/Mar/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsTableDecoderSupport : public nsBufferDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsTableDecoderSupport(uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable);
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsTableDecoderSupport();
|
||||
|
||||
protected:
|
||||
|
||||
nsIUnicodeDecodeHelper * mHelper; // decoder helper object
|
||||
uShiftTable * mShiftTable;
|
||||
uMappingTable * mMappingTable;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsBufferDecoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD ConvertNoBuff(const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsMultiTableDecoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for a multi-table-driven Unicode decoder.
|
||||
*
|
||||
* @created 24/Mar/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsMultiTableDecoderSupport : public nsBufferDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsMultiTableDecoderSupport(PRInt32 aTableCount, uRange * aRangeArray,
|
||||
uShiftTable ** aShiftTable, uMappingTable ** aMappingTable);
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsMultiTableDecoderSupport();
|
||||
|
||||
protected:
|
||||
|
||||
nsIUnicodeDecodeHelper * mHelper; // decoder helper object
|
||||
PRInt32 mTableCount;
|
||||
uRange * mRangeArray;
|
||||
uShiftTable ** mShiftTable;
|
||||
uMappingTable ** mMappingTable;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsBufferDecoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD ConvertNoBuff(const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBufferDecoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for a single-byte Unicode decoder.
|
||||
*
|
||||
* @created 19/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsOneByteDecoderSupport : public nsBasicDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsOneByteDecoderSupport(uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable);
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsOneByteDecoderSupport();
|
||||
|
||||
protected:
|
||||
|
||||
nsIUnicodeDecodeHelper * mHelper; // decoder helper object
|
||||
uShiftTable * mShiftTable;
|
||||
uMappingTable * mMappingTable;
|
||||
PRUnichar mFastTable[ONE_BYTE_TABLE_SIZE];
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsBasicDecoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD Convert(const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength);
|
||||
NS_IMETHOD GetMaxLength(const char * aSrc, PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength);
|
||||
NS_IMETHOD Reset();
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicEncoder [declaration]
|
||||
|
||||
class nsBasicEncoder : public nsIUnicodeEncoder, public nsICharRepresentable
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsBasicEncoder();
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsBasicEncoder();
|
||||
|
||||
};
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for the Unicode encoders.
|
||||
*
|
||||
* This class implements:
|
||||
* - nsISupports
|
||||
* - the buffer management
|
||||
* - error handling procedure(s)
|
||||
*
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsEncoderSupport : public nsBasicEncoder
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Internal buffer for partial conversions.
|
||||
*/
|
||||
char * mBuffer;
|
||||
PRInt32 mBufferCapacity;
|
||||
char * mBufferStart;
|
||||
char * mBufferEnd;
|
||||
|
||||
/**
|
||||
* Error handling stuff
|
||||
*/
|
||||
PRInt32 mErrBehavior;
|
||||
nsIUnicharEncoder * mErrEncoder;
|
||||
PRUnichar mErrChar;
|
||||
|
||||
/**
|
||||
* Convert method but *without* the buffer management stuff and *with*
|
||||
* error handling stuff.
|
||||
*/
|
||||
NS_IMETHOD ConvertNoBuff(const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
||||
char * aDest, PRInt32 * aDestLength);
|
||||
|
||||
/**
|
||||
* Convert method but *without* the buffer management stuff and *without*
|
||||
* error handling stuff.
|
||||
*/
|
||||
NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
||||
char * aDest, PRInt32 * aDestLength) = 0;
|
||||
|
||||
/**
|
||||
* Finish method but *without* the buffer management stuff.
|
||||
*/
|
||||
NS_IMETHOD FinishNoBuff(char * aDest, PRInt32 * aDestLength);
|
||||
|
||||
/**
|
||||
* Copy as much as possible from the internal buffer to the destination.
|
||||
*/
|
||||
nsresult FlushBuffer(char ** aDest, const char * aDestEnd);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsEncoderSupport();
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsEncoderSupport();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Interface nsIUnicodeEncoder [declaration]
|
||||
|
||||
NS_IMETHOD Convert(const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
||||
char * aDest, PRInt32 * aDestLength);
|
||||
NS_IMETHOD Finish(char * aDest, PRInt32 * aDestLength);
|
||||
NS_IMETHOD Reset();
|
||||
NS_IMETHOD SetOutputErrorBehavior(PRInt32 aBehavior,
|
||||
nsIUnicharEncoder * aEncoder, PRUnichar aChar);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Interface nsICharRepresentable [declaration]
|
||||
NS_IMETHOD FillInfo(PRUint32 *aInfo) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsTableEncoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for a single-table-driven Unicode encoder.
|
||||
*
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsTableEncoderSupport : public nsEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsTableEncoderSupport(uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable);
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsTableEncoderSupport();
|
||||
NS_IMETHOD FillInfo( PRUint32 *aInfo);
|
||||
|
||||
protected:
|
||||
|
||||
nsIUnicodeEncodeHelper * mHelper; // encoder helper object
|
||||
uShiftTable * mShiftTable;
|
||||
uMappingTable * mMappingTable;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsEncoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
||||
char * aDest, PRInt32 * aDestLength);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsMultiTableEncoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for a multi-table-driven Unicode encoder.
|
||||
*
|
||||
* @created 11/Mar/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsMultiTableEncoderSupport : public nsEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsMultiTableEncoderSupport(PRInt32 aTableCount, uShiftTable ** aShiftTable,
|
||||
uMappingTable ** aMappingTable);
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsMultiTableEncoderSupport();
|
||||
NS_IMETHOD FillInfo( PRUint32 *aInfo);
|
||||
|
||||
protected:
|
||||
|
||||
nsIUnicodeEncodeHelper * mHelper; // encoder helper object
|
||||
PRInt32 mTableCount;
|
||||
uShiftTable ** mShiftTable;
|
||||
uMappingTable ** mMappingTable;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsEncoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
||||
char * aDest, PRInt32 * aDestLength);
|
||||
};
|
||||
|
||||
#endif /* nsUCvMinSupport_h___ */
|
202
intl/uconv/src/nsUTF8ToUnicode.cpp
Normal file
202
intl/uconv/src/nsUTF8ToUnicode.cpp
Normal file
@ -0,0 +1,202 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsUCvMinSupport.h"
|
||||
#include "nsUTF8ToUnicode.h"
|
||||
|
||||
NS_IMETHODIMP NS_NewUTF8ToUnicode(nsISupports* aOuter,
|
||||
const nsIID& aIID,
|
||||
void** aResult)
|
||||
{
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsUTF8ToUnicode * inst = new nsUTF8ToUnicode();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUTF8ToUnicode [implementation]
|
||||
|
||||
nsUTF8ToUnicode::nsUTF8ToUnicode()
|
||||
: nsBasicDecoderSupport()
|
||||
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsTableDecoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsUTF8ToUnicode::GetMaxLength(const char * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsBasicDecoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsUTF8ToUnicode::Reset()
|
||||
{
|
||||
|
||||
mState = 0; // cached expected number of bytes per UTF8 character sequence
|
||||
mUcs4 = 0; // cached Unicode character
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsBasicDecoderSupport class [implementation]
|
||||
|
||||
|
||||
NS_IMETHODIMP nsUTF8ToUnicode::Convert(const char * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
|
||||
PRUint32 aSrcLen = (PRUint32) (*aSrcLength);
|
||||
PRUint32 aDestLen = (PRUint32) (*aDestLength);
|
||||
|
||||
const char *in, *inend;
|
||||
inend = aSrc + aSrcLen;
|
||||
|
||||
PRUnichar *out, *outend;
|
||||
outend = aDest + aDestLen;
|
||||
|
||||
nsresult res; // conversion result
|
||||
|
||||
for(in=aSrc,out=aDest,res=NS_OK;((in < inend) && (out < outend)); in++)
|
||||
{
|
||||
if(0 == mState) {
|
||||
if( 0 == (0x80 & (*in))) {
|
||||
// ASCII
|
||||
*out++ = (PRUnichar)*in;
|
||||
} else if( 0xC0 == (0xE0 & (*in))) {
|
||||
// 2 bytes UTF8
|
||||
mUcs4 = (PRUint32)(*in);
|
||||
mUcs4 = (mUcs4 << 6) & 0x000007C0L;
|
||||
mState=1;
|
||||
} else if( 0xE0 == (0xF0 & (*in))) {
|
||||
// 3 bytes UTF8
|
||||
mUcs4 = (PRUint32)(*in);
|
||||
mUcs4 = (mUcs4 << 12) & 0x0000F000L;
|
||||
mState=2;
|
||||
} else if( 0xF0 == (0xF8 & (*in))) {
|
||||
// 4 bytes UTF8
|
||||
mUcs4 = (PRUint32)(*in);
|
||||
mUcs4 = (mUcs4 << 18) & 0x001F0000L;
|
||||
mState=3;
|
||||
} else if( 0xF8 == (0xFC & (*in))) {
|
||||
// 5 bytes UTF8
|
||||
mUcs4 = (PRUint32)(*in);
|
||||
mUcs4 = (mUcs4 << 24) & 0x03000000L;
|
||||
mState=4;
|
||||
} else if( 0xFC == (0xFE & (*in))) {
|
||||
// 6 bytes UTF8
|
||||
mUcs4 = (PRUint32)(*in);
|
||||
mUcs4 = (mUcs4 << 30) & 0x40000000L;
|
||||
mState=5;
|
||||
} else {
|
||||
|
||||
//NS_ASSERTION(0, "The input string is not in utf8");
|
||||
|
||||
//unexpected octet, put in a replacement char,
|
||||
//flush and refill the buffer, reset state
|
||||
res = NS_ERROR_UNEXPECTED;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(0x80 == (0xC0 & (*in)))
|
||||
{
|
||||
PRUint32 tmp = (*in);
|
||||
int shift = (mState-1) * 6;
|
||||
tmp = (tmp << shift ) & ( 0x0000003FL << shift);
|
||||
mUcs4 |= tmp;
|
||||
if(0 == --mState)
|
||||
{
|
||||
if(mUcs4 >= 0x00010000) {
|
||||
if(mUcs4 >= 0x00110000) {
|
||||
*out++ = 0xFFFD;
|
||||
} else {
|
||||
mUcs4 -= 0x00010000;
|
||||
*out++ = 0xD800 | (0x000003FF & (mUcs4 >> 10));
|
||||
*out++ = 0xDC00 | (0x000003FF & mUcs4);
|
||||
}
|
||||
} else {
|
||||
if( 0xfeff != mUcs4 ) // ignore BOM
|
||||
*out++ = mUcs4;
|
||||
}
|
||||
|
||||
//initialize UTF8 cache
|
||||
Reset();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
//NS_ASSERTION(0, "The input string is not in utf8");
|
||||
|
||||
//unexpected octet, put in a replacement char,
|
||||
//flush and refill the buffer, reset state
|
||||
in--;
|
||||
res = NS_ERROR_UNEXPECTED;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//output not finished, output buffer too short
|
||||
if((NS_OK == res) && (in < inend) && (out >= outend))
|
||||
res = NS_OK_UDEC_MOREOUTPUT;
|
||||
|
||||
//last USC4 is incomplete, make sure the caller
|
||||
//returns with properly aligned continuation of the buffer
|
||||
if ((NS_OK == res) && (mState != 0))
|
||||
res = NS_OK_UDEC_MOREINPUT;
|
||||
|
||||
*aSrcLength = in - aSrc;
|
||||
*aDestLength = out - aDest;
|
||||
|
||||
return(res);
|
||||
|
||||
}
|
84
intl/uconv/src/nsUTF8ToUnicode.h
Normal file
84
intl/uconv/src/nsUTF8ToUnicode.h
Normal file
@ -0,0 +1,84 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsUTF8ToUnicode_h___
|
||||
#define nsUTF8ToUnicode_h___
|
||||
|
||||
// Class ID for our UTF8ToUnicode charset converter
|
||||
// {5534DDC0-DD96-11d2-8AAC-00600811A836}
|
||||
NS_DECLARE_ID(kUTF8ToUnicodeCID,
|
||||
0x5534ddc0, 0xdd96, 0x11d2, 0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
|
||||
#define NS_UTF8TOUNICODE_CID \
|
||||
{ 0x5534ddc0, 0xdd96, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_UTF8TOUNICODE_CONTRACTID "@mozilla.org/intl/unicode/decoder;1?charset=UTF8"
|
||||
|
||||
//#define NS_ERROR_UCONV_NOUTF8TOUNICODE \
|
||||
// NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x31)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUTF8ToUnicode [declaration]
|
||||
|
||||
|
||||
/**
|
||||
* A character set converter from UTF8 to Unicode.
|
||||
*
|
||||
* @created 18/Mar/1998
|
||||
* @modified 04/Feb/2000
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
|
||||
class nsUTF8ToUnicode : public nsBasicDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsUTF8ToUnicode();
|
||||
|
||||
protected:
|
||||
|
||||
PRUint32 mState; // cached expected number of bytes per UTF8 character sequence
|
||||
PRUint32 mUcs4; // cached Unicode character
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsDecoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD GetMaxLength(const char * aSrc, PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsBasicDecoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD Convert(const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsBasicDecoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD Reset();
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsUTF8ToUnicode_h___ */
|
||||
|
81
intl/uconv/src/nsUnicodeToCP1252.cpp
Normal file
81
intl/uconv/src/nsUnicodeToCP1252.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsUCvMinSupport.h"
|
||||
#include "nsUnicodeToCP1252.h"
|
||||
|
||||
NS_IMETHODIMP NS_NewUnicodeToCP1252(nsISupports* aOuter,
|
||||
const nsIID& aIID,
|
||||
void** aResult)
|
||||
{
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsUnicodeToCP1252 * inst = new nsUnicodeToCP1252();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static PRUint16 g_ufMappingTable[] = {
|
||||
#include "cp1252.uf"
|
||||
};
|
||||
|
||||
static PRInt16 g_ufShiftTable[] = {
|
||||
0, u1ByteCharset ,
|
||||
ShiftCell(0,0,0,0,0,0,0,0)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToCP1252 [implementation]
|
||||
|
||||
nsUnicodeToCP1252::nsUnicodeToCP1252()
|
||||
: nsTableEncoderSupport((uShiftTable*) &g_ufShiftTable,
|
||||
(uMappingTable*) &g_ufMappingTable)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsTableEncoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToCP1252::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK_UENC_EXACTLENGTH;
|
||||
}
|
65
intl/uconv/src/nsUnicodeToCP1252.h
Normal file
65
intl/uconv/src/nsUnicodeToCP1252.h
Normal file
@ -0,0 +1,65 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsUnicodeToCP1252_h___
|
||||
#define nsUnicodeToCP1252_h___
|
||||
|
||||
// Class ID for our UnicodeToCP1252 charset converter
|
||||
// {7B8556AC-EC79-11d2-8AAC-00600811A836}
|
||||
NS_DECLARE_ID(kUnicodeToCP1252CID,
|
||||
0x7b8556ac, 0xec79, 0x11d2, 0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
|
||||
#define NS_UNICODETOCP1252_CID \
|
||||
{ 0x7b8556ac, 0xec79, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_UNICODETOCP1252_CONTRACTID "@mozilla.org/intl/unicode/encoder;1?charset=windows-1252"
|
||||
|
||||
//#define NS_ERROR_UCONV_NOUNICODETOCP1252 \
|
||||
// NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x31)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToCP1252 [declaration]
|
||||
|
||||
/**
|
||||
* A character set converter from Unicode to CP1252.
|
||||
*
|
||||
* @created 20/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsUnicodeToCP1252 : public nsTableEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsUnicodeToCP1252();
|
||||
|
||||
protected:
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsEncoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength);
|
||||
};
|
||||
|
||||
#endif /* nsUnicodeToCP1252_h___ */
|
81
intl/uconv/src/nsUnicodeToISO88591.cpp
Normal file
81
intl/uconv/src/nsUnicodeToISO88591.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsUCvMinSupport.h"
|
||||
#include "nsUnicodeToISO88591.h"
|
||||
|
||||
NS_IMETHODIMP NS_NewUnicodeToISO88591(nsISupports* aOuter,
|
||||
const nsIID& aIID,
|
||||
void** aResult)
|
||||
{
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsUnicodeToISO88591 * inst = new nsUnicodeToISO88591();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static PRUint16 g_ufMappingTable[] = {
|
||||
#include "8859-1.uf"
|
||||
};
|
||||
|
||||
static PRInt16 g_ufShiftTable[] = {
|
||||
0, u1ByteCharset ,
|
||||
ShiftCell(0,0,0,0,0,0,0,0)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToISO88591 [implementation]
|
||||
|
||||
nsUnicodeToISO88591::nsUnicodeToISO88591()
|
||||
: nsTableEncoderSupport((uShiftTable*) &g_ufShiftTable,
|
||||
(uMappingTable*) &g_ufMappingTable)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsTableEncoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToISO88591::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK_UENC_EXACTLENGTH;
|
||||
}
|
||||
|
65
intl/uconv/src/nsUnicodeToISO88591.h
Normal file
65
intl/uconv/src/nsUnicodeToISO88591.h
Normal file
@ -0,0 +1,65 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsUnicodeToISO88591_h___
|
||||
#define nsUnicodeToISO88591_h___
|
||||
|
||||
// {920307B0-C6E8-11d2-8AA8-00600811A836}
|
||||
NS_DECLARE_ID(kUnicodeToISO88591CID,
|
||||
0x920307b0, 0xc6e8, 0x11d2, 0x8a, 0xa8, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
|
||||
#define NS_UNICODETOISO88591_CID \
|
||||
{ 0x920307b0, 0xc6e8, 0x11d2, {0x8a, 0xa8, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_UNICODETOISO88591_CONTRACTID "@mozilla.org/intl/unicode/encoder;1?charset=ISO-8859-1"
|
||||
|
||||
//#define NS_ERROR_UCONV_NOUNICODETOISO88591 \
|
||||
// NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x31)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToISO88591 [declaration]
|
||||
|
||||
/**
|
||||
* A character set converter from Unicode to ISO88591.
|
||||
*
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsUnicodeToISO88591 : public nsTableEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsUnicodeToISO88591();
|
||||
|
||||
protected:
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsEncoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength);
|
||||
};
|
||||
|
||||
#endif /* nsUnicodeToISO88591_h___ */
|
80
intl/uconv/src/nsUnicodeToMacRoman.cpp
Normal file
80
intl/uconv/src/nsUnicodeToMacRoman.cpp
Normal file
@ -0,0 +1,80 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsUCvMinSupport.h"
|
||||
#include "nsUnicodeToMacRoman.h"
|
||||
|
||||
NS_IMETHODIMP NS_NewUnicodeToMacRoman(nsISupports* aOuter,
|
||||
const nsIID& aIID,
|
||||
void** aResult)
|
||||
{
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsUnicodeToMacRoman * inst = new nsUnicodeToMacRoman();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static PRUint16 g_MacRomanMappingTable[] = {
|
||||
#include "macroman.uf"
|
||||
};
|
||||
|
||||
static PRInt16 g_MacRomanShiftTable[] = {
|
||||
1, u1ByteCharset ,
|
||||
ShiftCell(0,0,0,0,0,0,0,0)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToMacRoman [implementation]
|
||||
|
||||
nsUnicodeToMacRoman::nsUnicodeToMacRoman()
|
||||
: nsTableEncoderSupport((uShiftTable*) &g_MacRomanShiftTable,
|
||||
(uMappingTable*) &g_MacRomanMappingTable)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsTableEncoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToMacRoman::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK_UENC_EXACTLENGTH;
|
||||
}
|
62
intl/uconv/src/nsUnicodeToMacRoman.h
Normal file
62
intl/uconv/src/nsUnicodeToMacRoman.h
Normal file
@ -0,0 +1,62 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsUnicodeToMacRoman_h___
|
||||
#define nsUnicodeToMacRoman_h___
|
||||
|
||||
// Class ID for our UnicodeToMacRoman charset converter
|
||||
// {7B8556AF-EC79-11d2-8AAC-00600811A836}
|
||||
NS_DECLARE_ID(kUnicodeToMacRomanCID,
|
||||
0x7b8556af, 0xec79, 0x11d2, 0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
|
||||
#define NS_UNICODETOMACROMAN_CID \
|
||||
{ 0x7b8556af, 0xec79, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_UNICODETOMACROMAN_CONTRACTID "@mozilla.org/intl/unicode/encoder;1?charset=x-mac-roman"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToMacRoman [declaration]
|
||||
|
||||
/**
|
||||
* A character set converter from Unicode to MacRoman.
|
||||
*
|
||||
* @created 05/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsUnicodeToMacRoman : public nsTableEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsUnicodeToMacRoman();
|
||||
|
||||
protected:
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsEncoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength);
|
||||
};
|
||||
|
||||
#endif /* nsUnicodeToMacRoman_h___ */
|
91
intl/uconv/src/nsUnicodeToUTF8.cpp
Normal file
91
intl/uconv/src/nsUnicodeToUTF8.cpp
Normal file
@ -0,0 +1,91 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
#include "nsUCvMinSupport.h"
|
||||
#include "nsUnicodeToUTF8.h"
|
||||
#include <string.h>
|
||||
|
||||
NS_IMETHODIMP NS_NewUnicodeToUTF8(nsISupports* aOuter,
|
||||
const nsIID& aIID,
|
||||
void** aResult)
|
||||
{
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsUnicodeToUTF8 * inst = new nsUnicodeToUTF8();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static PRUint16 g_UTF8MappingTable[] = {
|
||||
0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0xFFFF, 0x0000
|
||||
};
|
||||
|
||||
static PRInt16 g_UTF8ShiftTable[] = {
|
||||
3, uMultibytesCharset,
|
||||
ShiftCell(u1ByteChar, 1, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x7F),
|
||||
ShiftCell(u2BytesUTF8, 2, 0xC0, 0xDF, 0x00, 0x00, 0x07, 0xFF),
|
||||
ShiftCell(u3BytesUTF8, 3, 0xE0, 0xEF, 0x08, 0x00, 0xFF, 0xFF)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToUTF8 [implementation]
|
||||
|
||||
nsUnicodeToUTF8::nsUnicodeToUTF8()
|
||||
: nsTableEncoderSupport((uShiftTable*) &g_UTF8ShiftTable,
|
||||
(uMappingTable*) &g_UTF8MappingTable)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsTableEncoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToUTF8::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
// in theory it should be 6, but since we do not handle
|
||||
// UCS4 and UTF-16 here. It is 3. We should change it to 6 when we
|
||||
// support UCS4 or UTF-16
|
||||
*aDestLength = 3*aSrcLength;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsUnicodeToUTF8::FillInfo(PRUint32 *aInfo)
|
||||
{
|
||||
memset(aInfo, 0xFF, (0x10000L >> 3));
|
||||
return NS_OK;
|
||||
}
|
67
intl/uconv/src/nsUnicodeToUTF8.h
Normal file
67
intl/uconv/src/nsUnicodeToUTF8.h
Normal file
@ -0,0 +1,67 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsUnicodeToUTF8_h___
|
||||
#define nsUnicodeToUTF8_h___
|
||||
|
||||
// Class ID for our UnicodeToUTF8 charset converter
|
||||
// {7C657D18-EC5E-11d2-8AAC-00600811A836}
|
||||
NS_DECLARE_ID(kUnicodeToUTF8CID,
|
||||
0x7c657d18, 0xec5e, 0x11d2, 0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
|
||||
#define NS_UNICODETOUTF8_CID \
|
||||
{ 0x7c657d18, 0xec5e, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_UNICODETOUTF8_CONTRACTID "@mozilla.org/intl/unicode/encoder;1?charset=UTF8"
|
||||
|
||||
//#define NS_ERROR_UCONV_NOUNICODETOUTF8 \
|
||||
// NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x31)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToUTF8 [declaration]
|
||||
|
||||
/**
|
||||
* A character set converter from Unicode to UTF8.
|
||||
*
|
||||
* @created 05/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsUnicodeToUTF8 : public nsTableEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsUnicodeToUTF8();
|
||||
|
||||
NS_IMETHOD FillInfo(PRUint32* aInfo);
|
||||
|
||||
protected:
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsEncoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength);
|
||||
};
|
||||
|
||||
#endif /* nsUnicodeToUTF8_h___ */
|
Loading…
x
Reference in New Issue
Block a user