Compare commits
2 Commits
alecf_ucon
...
mozilla
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a637f81f7f | ||
|
|
6cfadae5d1 |
@@ -1,54 +0,0 @@
|
||||
#
|
||||
# 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):
|
||||
# IBM Corporation
|
||||
#
|
||||
# This Original Code has been modified by IBM Corporation.
|
||||
# Modifications made by IBM described herein are
|
||||
# Copyright (c) International Business Machines
|
||||
# Corporation, 1999
|
||||
#
|
||||
# Modifications to Mozilla code or documentation
|
||||
# identified per MPL Section 3.3
|
||||
#
|
||||
# Date Modified by Description of modification
|
||||
# 12/09/1999 IBM Corp. Support for IBM codepages - 850,852,855,857,862,864
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = idl public util ucvja ucvcn ucvlatin ucvtw ucvtw2 ucvko ucvibm src
|
||||
|
||||
ifdef MOZ_MATHML
|
||||
DIRS += ucvmath
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ifdef ENABLE_TESTS
|
||||
DIRS += tests
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
Directory Structure :
|
||||
================================
|
||||
public - public header file
|
||||
src - source directory of charset converter manager and utility
|
||||
tests - tests program and application for charset converter
|
||||
|
||||
The following directory are used to put different charset converter
|
||||
|
||||
ucvam - Armenian charsets
|
||||
ucvar - Arabic charsets
|
||||
ucvcn - Simplified chinese charsets- GB2312, HZ, ISO-2022-CN
|
||||
ucvcy - Cyrillic charsets - ISO-8859-5, CP1251, KOI8-R, KOI8-U, Mac Cyrillic
|
||||
ucvgr - Greek charsets - ISO-8859-7, CP1253
|
||||
ucvhr - Hebrew charsets
|
||||
ucvja - Japanese charsets Set 1 - Shift-JIS
|
||||
ucvja2 - Japanese charsets Set 2 - ISO-2022-JP , EUC-JP
|
||||
ucvko - Korean charsets - ISO-2022-KR, EUC-KR
|
||||
ucvlatin - Latin charsets - ISO-8859-1,2,3,4,9,14,15, CP1250,1252,1254,
|
||||
Mac Roman, Central European, Romanian, Icelandic,
|
||||
etc
|
||||
ucvmath - Mathematical charsets (symbols for MathML/scientific documents)
|
||||
ucvth - Thai charsets
|
||||
ucvtw - Traditional Chinese charsets Set 1 - Big5
|
||||
ucvtw2 - Traditional Chinese charsets Set 2 - EUC-TW, ISO-2022-CN,
|
||||
ucvutf - UTF-8, UTF-7
|
||||
ucvvt - Vietnamese charsets
|
||||
|
||||
The following directory are obsolete and should not be used:
|
||||
|
||||
ufromam
|
||||
ufromar
|
||||
ufromcn
|
||||
ufromcy
|
||||
ufromgr
|
||||
ufromhr
|
||||
ufromja
|
||||
ufromja2
|
||||
ufromko
|
||||
ufroml
|
||||
ufromtw
|
||||
ufromtw2
|
||||
ufromutf
|
||||
ufromvt
|
||||
utoam
|
||||
utoar
|
||||
utocn
|
||||
utocy
|
||||
utogr
|
||||
utohr
|
||||
utoja
|
||||
utoja2
|
||||
utoko
|
||||
utol
|
||||
utotw
|
||||
utotw2
|
||||
utoutf
|
||||
utovt
|
||||
@@ -1,4 +0,0 @@
|
||||
nsITextToSubURI.idl
|
||||
nsICurrentCharsetListener.idl
|
||||
nsICharsetConverterManager2.idl
|
||||
nsIScriptableUConv.idl
|
||||
@@ -1,38 +0,0 @@
|
||||
#
|
||||
# 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):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = uconv
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsITextToSubURI.idl \
|
||||
nsICurrentCharsetListener.idl \
|
||||
nsICharsetConverterManager2.idl \
|
||||
nsIScriptableUConv.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
@@ -1,33 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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):
|
||||
|
||||
MODULE = uconv
|
||||
|
||||
DEPTH = ..\..\..
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsITextToSubURI.idl \
|
||||
.\nsICurrentCharsetListener.idl \
|
||||
.\nsICharsetConverterManager2.idl \
|
||||
.\nsIScriptableUConv.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
@@ -1,143 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
#include "nsIAtom.idl"
|
||||
%{ C++
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsString.h"
|
||||
%}
|
||||
|
||||
[ptr] native nsDecoderPtr(nsIUnicodeDecoder);
|
||||
[ptr] native nsEncoderPtr(nsIUnicodeEncoder);
|
||||
[ptr] native nsStringPtr(nsString);
|
||||
|
||||
/**
|
||||
* Replacement interface for nsICharsetConverterManager.
|
||||
*
|
||||
* Here Charsets are indentified by nsIAtom's. I know, we could have our own
|
||||
* interface for charsets (something like nsICharacterSet). But for now, I
|
||||
* will attempt to use Atom's. That is because it requires minimal work, all
|
||||
* the support stuff is already there. The drawback is that we might have some
|
||||
* performance loss from going to the Atom engine. Another possible problem is
|
||||
* people creating directly the Atom instead of going through GetCharsetAtom()
|
||||
* If these problems will hurt us, we'll switch to nsICharacterSet. The
|
||||
* implementation of this interface is ment to be quite flexible.
|
||||
*
|
||||
* I provide here some nonscriptable "friendly methods". They accept nsString
|
||||
* as params and assign the result to them, freeing the received memory result.
|
||||
* These methods are prone to optimisation, in order to elliminate any
|
||||
* allocation when it is not strictly necessary.
|
||||
*
|
||||
* @created 21/Feb/2000
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
[scriptable, uuid(8BAFE891-E4CC-11d3-9D0D-0050040007B2)]
|
||||
interface nsICharsetConverterManager2 : nsISupports
|
||||
{
|
||||
/**
|
||||
* Get the Unicode decoder for the given charset.
|
||||
*/
|
||||
[noscript] nsDecoderPtr GetUnicodeDecoder([const] in nsIAtom charset);
|
||||
|
||||
/**
|
||||
* Get the Unicode encoder for the given charset.
|
||||
*/
|
||||
[noscript] nsEncoderPtr GetUnicodeEncoder([const] in nsIAtom charset);
|
||||
|
||||
/**
|
||||
* Get the complete list of available decoders.
|
||||
*/
|
||||
nsISupportsArray GetDecoderList();
|
||||
|
||||
/**
|
||||
* Get the complete list of available encoders.
|
||||
*/
|
||||
nsISupportsArray GetEncoderList();
|
||||
|
||||
/**
|
||||
* Get the complete list of available charset detectors.
|
||||
*/
|
||||
nsISupportsArray GetCharsetDetectorList();
|
||||
|
||||
/**
|
||||
* Get the Atom representing the a given character set. PLEASE USE THIS
|
||||
* METHOD!!! Do not create Atoms directly by going to NS_NewAtom(), because
|
||||
* here we also do alias resolution...
|
||||
*
|
||||
* Just to let you know, this method will first attempt to resolve this
|
||||
* charset as an alias. If that failed, the original string will be used.
|
||||
* Then an atom is created and returned.
|
||||
*/
|
||||
nsIAtom GetCharsetAtom([const] in wstring charset);
|
||||
|
||||
/**
|
||||
* Friendlier version.
|
||||
*/
|
||||
nsIAtom GetCharsetAtom2([const] in string charset);
|
||||
|
||||
/**
|
||||
* Get the human-readable name for the given charset.
|
||||
*/
|
||||
wstring GetCharsetTitle([const] in nsIAtom charset);
|
||||
|
||||
/**
|
||||
* Friendlier but non scriptable version.
|
||||
*/
|
||||
[noscript] void GetCharsetTitle2([const] in nsIAtom charset,
|
||||
in nsStringPtr str);
|
||||
|
||||
/**
|
||||
* Get some data about the given charset.
|
||||
*/
|
||||
wstring GetCharsetData([const] in nsIAtom charset,
|
||||
[const] in wstring prop);
|
||||
|
||||
/**
|
||||
* Friendlier but non scriptable version.
|
||||
*/
|
||||
[noscript] void GetCharsetData2([const] in nsIAtom charset,
|
||||
[const] in wstring prop, in nsStringPtr str);
|
||||
|
||||
/**
|
||||
* Get the language group for the given charset.
|
||||
*/
|
||||
nsIAtom GetCharsetLangGroup([const] in nsIAtom charset);
|
||||
};
|
||||
@@ -1,54 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
|
||||
%{C++
|
||||
// {CF9428C1-DF50-11d3-9D0C-0050040007B2}
|
||||
#define NS_CURRENTCHARSETLISTENER_CID { 0xcf9428c1, 0xdf50, 0x11d3, { 0x9d, 0xc, 0x0, 0x50, 0x4, 0x0, 0x7, 0xb2 } }
|
||||
#define NS_ICURRENTCHARSETLISTENER_CONTRACTID "@mozilla.org/intl/currentcharsetlistener;1"
|
||||
%}
|
||||
|
||||
[scriptable, uuid(CF9428C1-DF50-11d3-9D0C-0050040007B2)]
|
||||
interface nsICurrentCharsetListener : nsISupports
|
||||
{
|
||||
void SetCurrentCharset(in wstring charset);
|
||||
void SetCurrentMailCharset(in wstring charset);
|
||||
void SetCurrentComposerCharset(in wstring charset);
|
||||
};
|
||||
@@ -1,70 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
%{C++
|
||||
// {0A698C44-3BFF-11d4-9649-00C0CA135B4E}
|
||||
#define NS_ISCRIPTABLEUNICODECONVERTER_CID { 0x0A698C44, 0x3BFF, 0x11d4, { 0x96, 0x49, 0x00, 0xC0, 0xCA, 0x13, 0x5B, 0x4E } }
|
||||
#define NS_ISCRIPTABLEUNICODECONVERTER_CONTRACTID "@mozilla.org/intl/scriptableunicodeconverter"
|
||||
%}
|
||||
|
||||
/**
|
||||
* This interface is unicode encoder using from script
|
||||
*
|
||||
* @created 8/Jun/2000
|
||||
* @author Makoto Kato [m_kato@ga2.so-net.ne.jp]
|
||||
*/
|
||||
[scriptable, uuid(0A698C44-3BFF-11d4-9649-00C0CA135B4E)]
|
||||
interface nsIScriptableUnicodeConverter : nsISupports
|
||||
{
|
||||
/**
|
||||
* Converts the data from Unicode to one Charset.
|
||||
*/
|
||||
string ConvertFromUnicode([const] in wstring aSrc);
|
||||
|
||||
/**
|
||||
* Converts the data from one Charset to Unicode.
|
||||
*/
|
||||
wstring ConvertToUnicode([const] in string aSrc);
|
||||
|
||||
/**
|
||||
* Current charactor set
|
||||
*/
|
||||
attribute wstring charset;
|
||||
};
|
||||
@@ -1,53 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
|
||||
%{C++
|
||||
// {8B042E22-6F87-11d3-B3C8-00805F8A6670}
|
||||
#define NS_TEXTTOSUBURI_CID { 0x8b042e22, 0x6f87, 0x11d3, { 0xb3, 0xc8, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }
|
||||
#define NS_ITEXTTOSUBURI_CONTRACTID "@mozilla.org/intl/texttosuburi;1"
|
||||
%}
|
||||
|
||||
[scriptable, uuid(8B042E24-6F87-11d3-B3C8-00805F8A6670)]
|
||||
interface nsITextToSubURI : nsISupports
|
||||
{
|
||||
string ConvertAndEscape(in string charset, in wstring text);
|
||||
wstring UnEscapeAndConvert(in string charset, in string text);
|
||||
};
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,53 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# 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):
|
||||
# IBM Corporation
|
||||
#
|
||||
# This Original Code has been modified by IBM Corporation.
|
||||
# Modifications made by IBM described herein are
|
||||
# Copyright (c) International Business Machines
|
||||
# Corporation, 1999
|
||||
#
|
||||
# Modifications to Mozilla code or documentation
|
||||
# identified per MPL Section 3.3
|
||||
#
|
||||
# Date Modified by Description of modification
|
||||
# 12/09/1999 IBM Corp. Support for IBM codepages - 850,852,855,857,862,864
|
||||
|
||||
DEPTH=..\..
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
DIRS=idl public src \
|
||||
ucvlatin \
|
||||
!ifdef MOZ_MATHML
|
||||
ucvmath \
|
||||
!endif
|
||||
ucvibm \
|
||||
ucvja \
|
||||
ucvcn \
|
||||
ucvtw \
|
||||
ucvtw2 \
|
||||
ucvko \
|
||||
!if !defined(DISABLE_TESTS)
|
||||
tests \
|
||||
!endif
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
@@ -1,11 +0,0 @@
|
||||
nsICharsetAlias.h
|
||||
nsICharsetConverterManager.h
|
||||
nsIPlatformCharset.h
|
||||
nsIUnicodeDecodeHelper.h
|
||||
nsIUnicodeDecoder.h
|
||||
nsIUnicodeEncodeHelper.h
|
||||
nsIUnicodeEncoder.h
|
||||
uconvutil.h
|
||||
nsIMappingCache.h
|
||||
nsICharRepresentable.h
|
||||
nsIConverterInputStream.h
|
||||
@@ -1,46 +0,0 @@
|
||||
#
|
||||
# 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):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = uconv
|
||||
|
||||
EXPORTS = \
|
||||
nsICharsetAlias.h \
|
||||
nsICharsetConverterManager.h \
|
||||
nsIPlatformCharset.h \
|
||||
nsIUnicodeDecodeHelper.h \
|
||||
nsIUnicodeDecoder.h \
|
||||
nsIUnicodeEncodeHelper.h \
|
||||
nsIUnicodeEncoder.h \
|
||||
nsICharRepresentable.h \
|
||||
nsIMappingCache.h \
|
||||
nsIConverterInputStream.h \
|
||||
uconvutil.h \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# 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):
|
||||
|
||||
DEPTH=..\..\..
|
||||
|
||||
EXPORTS = \
|
||||
nsICharsetAlias.h \
|
||||
nsICharsetConverterManager.h \
|
||||
nsIPlatformCharset.h \
|
||||
nsIUnicodeDecodeHelper.h \
|
||||
nsIUnicodeDecoder.h \
|
||||
nsIUnicodeEncodeHelper.h \
|
||||
nsIUnicodeEncoder.h \
|
||||
nsIMappingCache.h \
|
||||
nsICharRepresentable.h \
|
||||
nsIConverterInputStream.h \
|
||||
uconvutil.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE=uconv
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsICharRepresentable_h__
|
||||
#define nsICharRepresentable_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
// {A4D9A521-185A-11d3-B3BD-00805F8A6670}
|
||||
#define NS_ICHARREPRESENTABLE_IID \
|
||||
{ 0xa4d9a521, 0x185a, 0x11d3, { 0xb3, 0xbd, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }
|
||||
|
||||
|
||||
/*
|
||||
The following two macro have been duplicate in umap.c.
|
||||
You need to change both place to make it work
|
||||
*/
|
||||
#define IS_REPRESENTABLE(info, c) (((info)[(c) >> 5] >> ((c) & 0x1f)) & 1L)
|
||||
#define SET_REPRESENTABLE(info, c) (info)[(c) >> 5] |= (1L << ((c) & 0x1f))
|
||||
#define CLEAR_REPRESENTABLE(info, c) (info)[(c) >> 5] &= (~(1L << ((c) & 0x1f)))
|
||||
|
||||
// number of PRUint32 in the 64Kbit char map
|
||||
#define UCS2_MAP_LEN 2048
|
||||
|
||||
/**
|
||||
*/
|
||||
class nsICharRepresentable : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICHARREPRESENTABLE_IID)
|
||||
|
||||
NS_IMETHOD FillInfo(PRUint32* aInfo) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIUnicodeDecoder_h__ */
|
||||
@@ -1,77 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsICharsetAlias_h___
|
||||
#define nsICharsetAlias_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
// {CCD4D374-CCDC-11d2-B3B1-00805F8A6670}
|
||||
#define NS_ICHARSETALIAS_IID \
|
||||
{ 0xccd4d374, 0xccdc, 0x11d2, { 0xb3, 0xb1, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 }}
|
||||
static NS_DEFINE_IID(kICharsetAliasIID, NS_ICHARSETALIAS_IID);
|
||||
|
||||
|
||||
// {98D41C21-CCF3-11d2-B3B1-00805F8A6670}
|
||||
#define NS_CHARSETALIAS_CID \
|
||||
{ 0x98d41c21, 0xccf3, 0x11d2, { 0xb3, 0xb1, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 }}
|
||||
static NS_DEFINE_IID(kCharsetAliasCID, NS_CHARSETALIAS_CID);
|
||||
|
||||
#define NS_CHARSETALIAS_CID \
|
||||
{ 0x98d41c21, 0xccf3, 0x11d2, { 0xb3, 0xb1, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 }}
|
||||
|
||||
#define NS_CHARSETALIAS_CONTRACTID "@mozilla.org/intl/charsetalias;1"
|
||||
|
||||
class nsICharsetAlias : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICHARSETALIAS_IID)
|
||||
|
||||
NS_IMETHOD GetPreferred(const nsAString& aAlias, nsAString& aResult) = 0;
|
||||
NS_IMETHOD GetPreferred(const PRUnichar* aAlias, const PRUnichar** aResult) = 0;
|
||||
NS_IMETHOD GetPreferred(const char* aAlias, char* aResult, PRInt32 aBufLength) = 0;
|
||||
|
||||
NS_IMETHOD Equals(const nsAString& aCharset1, const nsAString& aCharset2, PRBool* aResult) = 0;
|
||||
NS_IMETHOD Equals(const PRUnichar* aCharset1, const PRUnichar* aCharset2, PRBool* aResult) = 0;
|
||||
NS_IMETHOD Equals(const char* aCharset1, const char* aCharset2, PRBool* aResult) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsICharsetAlias_h___ */
|
||||
@@ -1,230 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Morten Nilsen <morten@nilsen.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsICharsetConverterManager_h___
|
||||
#define nsICharsetConverterManager_h___
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsError.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsICategoryManager.h"
|
||||
|
||||
#define NS_ICHARSETCONVERTERMANAGER_IID \
|
||||
{0x3c1c0161, 0x9bd0, 0x11d3, { 0x9d, 0x9, 0x0, 0x50, 0x4, 0x0, 0x7, 0xb2}}
|
||||
|
||||
// XXX change to NS_CHARSETCONVERTERMANAGER_CID
|
||||
#define NS_ICHARSETCONVERTERMANAGER_CID \
|
||||
{0x3c1c0163, 0x9bd0, 0x11d3, { 0x9d, 0x9, 0x0, 0x50, 0x4, 0x0, 0x7, 0xb2}}
|
||||
|
||||
// XXX change to NS_CHARSETCONVERTERMANAGER_PID
|
||||
#define NS_CHARSETCONVERTERMANAGER_CONTRACTID "@mozilla.org/charset-converter-manager;1"
|
||||
|
||||
#define NS_DATA_BUNDLE_CATEGORY "uconv-charset-data"
|
||||
#define NS_TITLE_BUNDLE_CATEGORY "uconv-charset-titles"
|
||||
|
||||
#define NS_ERROR_UCONV_NOCONV \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x01)
|
||||
|
||||
#define NS_SUCCESS_USING_FALLBACK_LOCALE \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_UCONV, 0x02)
|
||||
|
||||
#ifdef DEBUG
|
||||
#define REGSELF_PRINTF(x,y) \
|
||||
fprintf(stderr,"RegSelf %s to %s converter complete\n", \
|
||||
x, y)
|
||||
#else
|
||||
#define REGSELF_PRINTF(x,y)
|
||||
#endif
|
||||
|
||||
#define NS_UNICODEDECODER_NAME "Charset Decoders"
|
||||
#define NS_UNICODEENCODER_NAME "Charset Encoders"
|
||||
|
||||
struct nsConverterRegistryInfo {
|
||||
PRBool isEncoder; // PR_TRUE = encoder, PR_FALSE = decoder
|
||||
const char *charset;
|
||||
nsCID cid;
|
||||
};
|
||||
|
||||
#define NS_CONVERTER_REGISTRY_START \
|
||||
static const nsConverterRegistryInfo gConverterRegistryInfo[] = {
|
||||
|
||||
#define NS_CONVERTER_REGISTRY_END \
|
||||
};
|
||||
|
||||
|
||||
#define NS_IMPL_NSUCONVERTERREGSELF \
|
||||
static NS_IMETHODIMP \
|
||||
nsUConverterRegSelf(nsIComponentManager *aCompMgr, \
|
||||
nsIFile *aPath, \
|
||||
const char* registryLocation, \
|
||||
const char* componentType, \
|
||||
const nsModuleComponentInfo *info) \
|
||||
{ \
|
||||
nsresult rv; \
|
||||
nsCOMPtr<nsICategoryManager> catman = \
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
|
||||
if (NS_FAILED(rv)) return rv; \
|
||||
\
|
||||
nsXPIDLCString previous; \
|
||||
PRUint32 i; \
|
||||
for (i=0; i<sizeof(gConverterRegistryInfo)/sizeof(gConverterRegistryInfo[0]); i++) { \
|
||||
const nsConverterRegistryInfo* entry = &gConverterRegistryInfo[i]; \
|
||||
const char *category; \
|
||||
const char *key; \
|
||||
\
|
||||
if (entry->isEncoder) { \
|
||||
category = NS_UNICODEENCODER_NAME; \
|
||||
} else { \
|
||||
category = NS_UNICODEDECODER_NAME; \
|
||||
} \
|
||||
key = entry->charset; \
|
||||
\
|
||||
rv = catman->AddCategoryEntry(category, key, "", \
|
||||
PR_TRUE, \
|
||||
PR_TRUE, \
|
||||
getter_Copies(previous)); \
|
||||
} \
|
||||
return rv; \
|
||||
} \
|
||||
static NS_IMETHODIMP \
|
||||
nsUConverterUnregSelf(nsIComponentManager *aCompMgr, \
|
||||
nsIFile *aPath, \
|
||||
const char*, \
|
||||
const nsModuleComponentInfo *info) \
|
||||
{ \
|
||||
nsresult rv; \
|
||||
nsCOMPtr<nsICategoryManager> catman = \
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
|
||||
if (NS_FAILED(rv)) return rv; \
|
||||
\
|
||||
nsXPIDLCString previous; \
|
||||
PRUint32 i; \
|
||||
for (i=0; i<sizeof(gConverterRegistryInfo)/sizeof(gConverterRegistryInfo[0]); i++) { \
|
||||
const nsConverterRegistryInfo* entry = &gConverterRegistryInfo[i]; \
|
||||
const char *category; \
|
||||
const char *key; \
|
||||
\
|
||||
if (entry->isEncoder) { \
|
||||
category = NS_UNICODEDECODER_NAME; \
|
||||
} else { \
|
||||
category = NS_UNICODEENCODER_NAME; \
|
||||
} \
|
||||
key = entry->charset; \
|
||||
\
|
||||
char * value = entry->cid.ToString(); \
|
||||
\
|
||||
rv = catman->DeleteCategoryEntry(category, key, PR_TRUE); \
|
||||
CRTFREEIF(value); \
|
||||
} \
|
||||
return rv; \
|
||||
}
|
||||
|
||||
|
||||
#define NS_UCONV_REG_UNREG_DECODER(_Charset, _CID) \
|
||||
{ \
|
||||
PR_FALSE, \
|
||||
_Charset, \
|
||||
_CID, \
|
||||
},
|
||||
|
||||
#define NS_UCONV_REG_UNREG_ENCODER(_Charset, _CID) \
|
||||
{ \
|
||||
PR_TRUE, \
|
||||
_Charset, \
|
||||
_CID, \
|
||||
},
|
||||
|
||||
// this needs to be written out per some odd cpp behavior that
|
||||
// I could not work around - the behavior is document in the cpp
|
||||
// info page however, so I'm not the only one to hit this!
|
||||
#define NS_UCONV_REG_UNREG(_Charset, _DecoderCID, _EncoderCID) \
|
||||
{ \
|
||||
PR_FALSE, \
|
||||
_Charset, \
|
||||
_DecoderCID, \
|
||||
}, \
|
||||
{ \
|
||||
PR_TRUE, \
|
||||
_Charset, \
|
||||
_EncoderCID, \
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Interface for a Manager of Charset Converters.
|
||||
*
|
||||
* This Manager's data is a cache of the stuff available directly through
|
||||
* Registry and Extensible String Bundles. Plus a set of convenient APIs.
|
||||
*
|
||||
* Note: The term "Charset" used in the classes, interfaces and file names
|
||||
* should be read as "Coded Character Set". I am saying "charset" only for
|
||||
* length considerations: it is a much shorter word. This convention is for
|
||||
* source-code only, in the attached documents I will be either using the
|
||||
* full expression or I'll specify a different convention.
|
||||
*
|
||||
* A DECODER converts from a random encoding into Unicode.
|
||||
* An ENCODER converts from Unicode into a random encoding.
|
||||
* All our data structures and APIs are divided like that.
|
||||
* However, when you have a charset data, you may have 3 cases:
|
||||
* a) the data is charset-dependet, but it is common for encoders and decoders
|
||||
* b) the data is different for the two of them, thus needing different APIs
|
||||
* and different "aProp" identifying it.
|
||||
* c) the data is relevant only for one: encoder or decoder; its nature making
|
||||
* the distinction.
|
||||
*
|
||||
* @created 15/Nov/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsICharsetConverterManager : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICHARSETCONVERTERMANAGER_IID)
|
||||
|
||||
NS_IMETHOD GetUnicodeEncoder(const nsString * aDest,
|
||||
nsIUnicodeEncoder ** aResult) = 0;
|
||||
NS_IMETHOD GetUnicodeDecoder(const nsString * aSrc,
|
||||
nsIUnicodeDecoder ** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetCharsetLangGroup(nsString * aCharset, nsIAtom ** aResult) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsICharsetConverterManager_h___ */
|
||||
@@ -1,53 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIUnicharInputStream.h"
|
||||
|
||||
// {FC66FFB6-5404-4908-A4A3-27F92FA0579D}
|
||||
#define NS_ICONVERTERSTREAM_IID \
|
||||
{ 0xfc66ffb6, 0x5404, 0x4908, \
|
||||
{ 0xa4, 0xa3, 0x27, 0xf9, 0x2f, 0xa0, 0x57, 0x9d } }
|
||||
|
||||
class nsIConverterInputStream : public nsIUnicharInputStream {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICONVERTERSTREAM_IID)
|
||||
|
||||
NS_IMETHOD Init(nsIInputStream *aStream, const PRUnichar *aCharset,
|
||||
PRInt32 aBufferSize) = 0;
|
||||
};
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsIMappingCache_h__
|
||||
#define nsIMappingCache_h__
|
||||
|
||||
typedef void* nsIMappingCache;
|
||||
|
||||
typedef enum {
|
||||
kMappingCacheType64 = 0x003F,
|
||||
kMappingCacheType128 = 0x007F,
|
||||
kMappingCacheType256 = 0x00FF,
|
||||
kMappingCacheType512 = 0x01FF
|
||||
} nsMappingCacheType;
|
||||
|
||||
|
||||
#endif /* nsIMappingCache_h__ */
|
||||
@@ -1,77 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsIPlatformCharset_h__
|
||||
#define nsIPlatformCharset_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
// Interface ID for our nsIPlatformCharset interface
|
||||
|
||||
#define NS_IPLATFORMCHARSET_IID \
|
||||
{ 0x84b0f181, 0xc6c7, 0x11d2, {0xb3, 0xb0, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 }}
|
||||
|
||||
#define NS_PLATFORMCHARSET_CID \
|
||||
{ 0x84b0f182, 0xc6c7, 0x11d2, {0xb3, 0xb0, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 }}
|
||||
|
||||
#define NS_PLATFORMCHARSET_CONTRACTID "@mozilla.org/intl/platformcharset;1"
|
||||
|
||||
typedef enum {
|
||||
kPlatformCharsetSel_PlainTextInClipboard = 0,
|
||||
kPlatformCharsetSel_FileName = 1,
|
||||
kPlatformCharsetSel_Menu = 2,
|
||||
kPlatformCharsetSel_4xBookmarkFile = 3,
|
||||
kPlatformCharsetSel_KeyboardInput = 4,
|
||||
kPlatformCharsetSel_WindowManager = 5,
|
||||
kPlatformCharsetSel_4xPrefsJS = 6
|
||||
} nsPlatformCharsetSel;
|
||||
|
||||
class nsIPlatformCharset : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPLATFORMCHARSET_IID)
|
||||
|
||||
NS_IMETHOD GetCharset(nsPlatformCharsetSel selector, nsAString& oResult) = 0;
|
||||
|
||||
NS_IMETHOD GetDefaultCharsetForLocale(const PRUnichar* localeName, PRUnichar** _retValue) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIPlatformCharset_h__ */
|
||||
@@ -1,118 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsIUnicodeDecodeHelper_h___
|
||||
#define nsIUnicodeDecodeHelper_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "uconvutil.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIMappingCache.h"
|
||||
|
||||
// Interface ID for our Unicode Decode Helper interface
|
||||
// {9CC39FF0-DD5D-11d2-8AAC-00600811A836}
|
||||
#define NS_IUNICODEDECODEHELPER_IID \
|
||||
{ 0x9cc39ff0, 0xdd5d, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
// Class ID for our UnicodeDecoderHelper implementation
|
||||
// {9CC39FF1-DD5D-11d2-8AAC-00600811A836}
|
||||
#define NS_UNICODEDECODEHELPER_CID \
|
||||
{ 0x9cc39ff1, 0xdd5d, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_UNICODEDECODEHELPER_CONTRACTID "@mozilla.org/intl/unicode/decodehelper;1"
|
||||
|
||||
#define NS_ERROR_UDEC_NOHELPER \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x41)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsIUnicodeDecodeHelper [declaration]
|
||||
|
||||
/**
|
||||
* Interface for a Unicode Decode Helper object.
|
||||
*
|
||||
* @created 22/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsIUnicodeDecodeHelper : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IUNICODEDECODEHELPER_IID)
|
||||
|
||||
/**
|
||||
* Converts data using a lookup table.
|
||||
*/
|
||||
NS_IMETHOD ConvertByTable(const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength, uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable) = 0;
|
||||
|
||||
/**
|
||||
* Converts data using a set of lookup tables.
|
||||
*/
|
||||
NS_IMETHOD ConvertByMultiTable(const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength, PRInt32 aTableCount,
|
||||
uRange * aRangeArray, uShiftTable ** aShiftTable,
|
||||
uMappingTable ** aMappingTable) = 0;
|
||||
|
||||
/**
|
||||
* Converts data using a fast lookup table.
|
||||
*/
|
||||
NS_IMETHOD ConvertByFastTable(const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength, PRUnichar * aFastTable,
|
||||
PRInt32 aTableSize) = 0;
|
||||
|
||||
/**
|
||||
* Create a Mapping Cache
|
||||
*/
|
||||
|
||||
NS_IMETHOD CreateCache(nsMappingCacheType aType, nsIMappingCache* aResult) = 0;
|
||||
/**
|
||||
* Destroy a Mapping Cache
|
||||
*/
|
||||
|
||||
NS_IMETHOD DestroyCache(nsIMappingCache aCache) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Create a cache-like fast lookup table from a normal one.
|
||||
*/
|
||||
NS_IMETHOD CreateFastTable( uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable, PRUnichar * aFastTable,
|
||||
PRInt32 aTableSize) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIUnicodeDecodeHelper_h___ */
|
||||
@@ -1,172 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsIUnicodeDecoder_h___
|
||||
#define nsIUnicodeDecoder_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
// Interface ID for our Unicode Decoder interface
|
||||
// {B2F178E1-832A-11d2-8A8E-00600811A836}
|
||||
//NS_DECLARE_ID(kIUnicodeDecoderIID,
|
||||
// 0xb2f178e1, 0x832a, 0x11d2, 0x8a, 0x8e, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
|
||||
|
||||
#define NS_IUNICODEDECODER_IID \
|
||||
{ 0xb2f178e1, 0x832a, 0x11d2, \
|
||||
{ 0x8a, 0x8e, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36 }}
|
||||
static NS_DEFINE_IID(kIUnicodeDecoderIID, NS_IUNICODEDECODER_IID);
|
||||
|
||||
// XXX deprecated
|
||||
/*---------- BEGIN DEPRECATED */
|
||||
#define NS_EXACT_LENGTH \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_UCONV, 11)
|
||||
|
||||
#define NS_PARTIAL_MORE_INPUT \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_UCONV, 12)
|
||||
|
||||
#define NS_PARTIAL_MORE_OUTPUT \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_UCONV, 13)
|
||||
|
||||
#define NS_ERROR_ILLEGAL_INPUT \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 14)
|
||||
/*---------- END DEPRECATED */
|
||||
|
||||
// XXX make us hex! (same digits though)
|
||||
#define NS_OK_UDEC_EXACTLENGTH \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_UCONV, 11)
|
||||
|
||||
#define NS_OK_UDEC_MOREINPUT \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_UCONV, 12)
|
||||
|
||||
#define NS_OK_UDEC_MOREOUTPUT \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_UCONV, 13)
|
||||
|
||||
#define NS_ERROR_UDEC_ILLEGALINPUT \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 14)
|
||||
|
||||
|
||||
#define NS_UNICODEDECODER_CONTRACTID_BASE "@mozilla.org/intl/unicode/decoder;1?charset="
|
||||
|
||||
/**
|
||||
* Interface for a Converter from a Charset into Unicode.
|
||||
*
|
||||
* @created 23/Nov/1998
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsIUnicodeDecoder : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IUNICODEDECODER_IID)
|
||||
|
||||
enum {
|
||||
kOnError_Recover, // on an error, recover and continue
|
||||
kOnError_Signal // on an error, stop and signal
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts the data from one Charset to Unicode.
|
||||
*
|
||||
* About the byte ordering:
|
||||
* - For input, if the converter cares (that depends of the charset, for
|
||||
* example a singlebyte will ignore the byte ordering) it should assume
|
||||
* network order. If necessary and requested, we can add a method
|
||||
* SetInputByteOrder() so that the reverse order can be used, too. That
|
||||
* method would have as default the assumed network order.
|
||||
* - The output stream is Unicode, having the byte order which is internal
|
||||
* for the machine on which the converter is running on.
|
||||
*
|
||||
* Unless there is not enough output space, this method must consume all the
|
||||
* available input data! The eventual incomplete final character data will be
|
||||
* stored internally in the converter and used when the method is called
|
||||
* again for continuing the conversion. This way, the caller will not have to
|
||||
* worry about managing incomplete input data by mergeing it with the next
|
||||
* buffer.
|
||||
*
|
||||
* Error conditions:
|
||||
* If the read value does not belong to this character set, one should
|
||||
* replace it with the Unicode special 0xFFFD. When an actual input error is
|
||||
* encountered, like a format error, the converter stop and return error.
|
||||
* Hoever, we should keep in mind that we need to be lax in decoding.
|
||||
*
|
||||
* Converter required behavior:
|
||||
* In this order: when output space is full - return right away. When input
|
||||
* data is wrong, return input pointer right after the wrong byte. When
|
||||
* partial input, it will be consumed and cached. All the time input pointer
|
||||
* will show how much was actually consumed and how much was actually
|
||||
* written.
|
||||
*
|
||||
* @param aSrc [IN] the source data buffer
|
||||
* @param aSrcLength [IN/OUT] the length of source data buffer; after
|
||||
* conversion will contain the number of bytes read
|
||||
* @param aDest [OUT] the destination data buffer
|
||||
* @param aDestLength [IN/OUT] the length of the destination data buffer;
|
||||
* after conversion will contain the number of Unicode
|
||||
* characters written
|
||||
* @return NS_PARTIAL_MORE_INPUT if only a partial conversion was
|
||||
* done; more input is needed to continue
|
||||
* NS_PARTIAL_MORE_OUTPUT if only a partial conversion
|
||||
* was done; more output space is needed to continue
|
||||
* NS_ERROR_ILLEGAL_INPUT if an illegal input sequence
|
||||
* was encountered and the behavior was set to "signal"
|
||||
*/
|
||||
NS_IMETHOD Convert(const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength) = 0;
|
||||
|
||||
/**
|
||||
* Returns a quick estimation of the size of the buffer needed to hold the
|
||||
* converted data. Remember: this estimation is >= with the actual size of
|
||||
* the buffer needed. It will be computed for the "worst case"
|
||||
*
|
||||
* @param aSrc [IN] the source data buffer
|
||||
* @param aSrcLength [IN] the length of source data buffer
|
||||
* @param aDestLength [OUT] the needed size of the destination buffer
|
||||
* @return NS_EXACT_LENGTH if an exact length was computed
|
||||
* NS_OK is all we have is an approximation
|
||||
*/
|
||||
NS_IMETHOD GetMaxLength(const char * aSrc, PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength) = 0;
|
||||
|
||||
/**
|
||||
* Resets the charset converter so it may be recycled for a completely
|
||||
* different and urelated buffer of data.
|
||||
*/
|
||||
NS_IMETHOD Reset() = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIUnicodeDecoder_h___ */
|
||||
@@ -1,111 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsIUnicodeEncodeHelper_h___
|
||||
#define nsIUnicodeEncodeHelper_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "uconvutil.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIMappingCache.h"
|
||||
|
||||
// Interface ID for our Unicode Encode Helper interface
|
||||
// {D8E6B700-CA9D-11d2-8AA9-00600811A836}
|
||||
#define NS_IUNICODEENCODEHELPER_IID \
|
||||
{ 0xd8e6b700, 0xca9d, 0x11d2, {0x8a, 0xa9, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
// Class ID for our UnicodeEncoderHelper implementation
|
||||
// {1767FC50-CAA4-11d2-8AA9-00600811A836}
|
||||
#define NS_UNICODEENCODEHELPER_CID \
|
||||
{ 0x1767fc50, 0xcaa4, 0x11d2, {0x8a, 0xa9, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
|
||||
#define NS_UNICODEENCODEHELPER_CONTRACTID "@mozilla.org/intl/unicode/encodehelper;1"
|
||||
|
||||
#define NS_ERROR_UENC_NOHELPER \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x31)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsIUnicodeEncodeHelper [declaration]
|
||||
|
||||
/**
|
||||
* Interface for a Unicode Encode Helper object.
|
||||
*
|
||||
* @created 22/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsIUnicodeEncodeHelper : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IUNICODEENCODEHELPER_IID)
|
||||
|
||||
/**
|
||||
* Converts data using a lookup table.
|
||||
*/
|
||||
NS_IMETHOD ConvertByTable(const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
||||
char * aDest, PRInt32 * aDestLength, uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable) = 0;
|
||||
|
||||
/**
|
||||
* Converts data using a set of lookup tables.
|
||||
*/
|
||||
NS_IMETHOD ConvertByMultiTable(const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
||||
char * aDest, PRInt32 * aDestLength, PRInt32 aTableCount,
|
||||
uShiftTable ** aShiftTable, uMappingTable ** aMappingTable) = 0;
|
||||
|
||||
/**
|
||||
* Create a Mapping Cache
|
||||
*/
|
||||
NS_IMETHOD CreateCache(nsMappingCacheType aType, nsIMappingCache* aResult) = 0;
|
||||
|
||||
/**
|
||||
* Destroy a Mapping Cache
|
||||
*/
|
||||
NS_IMETHOD DestroyCache(nsIMappingCache aCache) = 0;
|
||||
|
||||
/**
|
||||
* Create Char Representable Info
|
||||
*/
|
||||
NS_IMETHOD FillInfo(PRUint32* aInfo, uMappingTable * aMappingTable) = 0;
|
||||
NS_IMETHOD FillInfo(PRUint32* aInfo, PRInt32 aTableCount, uMappingTable ** aMappingTable) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* nsIUnicodeEncodeHelper_h___ */
|
||||
@@ -1,222 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsIUnicodeEncoder_h___
|
||||
#define nsIUnicodeEncoder_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsError.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
// Interface ID for our Unicode Encoder interface
|
||||
// {2B2CA3D0-A4C9-11d2-8AA1-00600811A836}
|
||||
#define NS_IUNICODEENCODER_IID \
|
||||
{ 0x2b2ca3d0, 0xa4c9, 0x11d2, \
|
||||
{ 0x8a, 0xa1, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36 }}
|
||||
static NS_DEFINE_IID(kIUnicodeEncoderIID, NS_IUNICODEENCODER_IID);
|
||||
|
||||
// Interface ID for our Unicode Character Encoder interface
|
||||
// {299BCCD0-C6DF-11d2-8AA8-00600811A836}
|
||||
#define NS_IUNICHARENCODER_IID \
|
||||
{ 0x299bccd0, 0xc6df, 0x11d2, \
|
||||
{0x8a, 0xa8, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36 }}
|
||||
static NS_DEFINE_IID(kIUnicharEncoderIID, NS_IUNICHARENCODER_IID);
|
||||
|
||||
#define NS_OK_UENC_EXACTLENGTH \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_UCONV, 0x21)
|
||||
|
||||
#define NS_OK_UENC_MOREOUTPUT \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_UCONV, 0x22)
|
||||
|
||||
#define NS_ERROR_UENC_NOMAPPING \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_UCONV, 0x23)
|
||||
|
||||
#define NS_OK_UENC_MOREINPUT \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_UCONV, 0x24)
|
||||
|
||||
|
||||
#define NS_UNICODEENCODER_CONTRACTID_BASE "@mozilla.org/intl/unicode/encoder;1?charset="
|
||||
|
||||
/**
|
||||
* Interface which converts a single character from Unicode into a given
|
||||
* charset.
|
||||
*
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsIUnicharEncoder : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IUNICHARENCODER_IID)
|
||||
|
||||
/**
|
||||
* Converts a character from Unicode to a Charset.
|
||||
*/
|
||||
NS_IMETHOD Convert(PRUnichar aChar, char * aDest, PRInt32 * aDestLength) = 0;
|
||||
};
|
||||
|
||||
//
|
||||
// Malloc an Encoder (unicode -> charset) buffer if the
|
||||
// result won't fit in the static buffer
|
||||
//
|
||||
// p = the buffer pointer (char*)
|
||||
// e = encoder (nsIUnicodeEncoder*)
|
||||
// s = string (PRUnichar*)
|
||||
// l = string length (PRInt32)
|
||||
// sb = static buffer (char[])
|
||||
// sbl = static buffer length (PRUint32)
|
||||
// al = actual buffer length (PRInt32)
|
||||
//
|
||||
#define ENCODER_BUFFER_ALLOC_IF_NEEDED(p,e,s,l,sb,sbl,al) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (e \
|
||||
&& NS_SUCCEEDED((e)->GetMaxLength((s), (l), &(al)))\
|
||||
&& ((al) > (PRInt32)(sbl)) \
|
||||
&& (nsnull!=((p)=(char*)nsMemory::Alloc((al)+1))) \
|
||||
) { \
|
||||
} \
|
||||
else { \
|
||||
(p) = (char*)(sb); \
|
||||
(al) = (sbl); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
//
|
||||
// Free the Encoder buffer if it was allocated
|
||||
//
|
||||
#define ENCODER_BUFFER_FREE_IF_NEEDED(p,sb) \
|
||||
PR_BEGIN_MACRO \
|
||||
if ((p) != (char*)(sb)) \
|
||||
nsMemory::Free(p); \
|
||||
PR_END_MACRO
|
||||
|
||||
/**
|
||||
* Interface for a Converter from Unicode into a Charset.
|
||||
*
|
||||
* @created 23/Nov/1998
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsIUnicodeEncoder : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IUNICODEENCODER_IID)
|
||||
|
||||
enum {
|
||||
kOnError_Signal, // on an error, stop and signal
|
||||
kOnError_CallBack, // on an error, call the error handler
|
||||
kOnError_Replace // on an error, replace with a different character
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts the data from Unicode to a Charset.
|
||||
*
|
||||
* About the byte ordering:
|
||||
* - The input stream is Unicode, having the byte order which is internal
|
||||
* for the machine on which the converter is running on.
|
||||
* - For output, if the converter cares (that depends of the charset, for
|
||||
* example a singlebyte will ignore the byte ordering) it should assume
|
||||
* network order. If necessary and requested, we can add a method
|
||||
* SetOutputByteOrder() so that the reverse order can be used, too. That
|
||||
* method would have as default the assumed network order.
|
||||
*
|
||||
* Unless there is not enough output space, this method must consume all the
|
||||
* available input data! We don't have partial input for the Unicode charset.
|
||||
* And for the last converted char, even if there is not enought output
|
||||
* space, a partial ouput must be done until all available space will be
|
||||
* used. The rest of the output should be buffered until more space becomes
|
||||
* available. But this is not also true about the error handling method!!!
|
||||
* So be very, very careful...
|
||||
*
|
||||
* @param aSrc [IN] the source data buffer
|
||||
* @param aSrcLength [IN/OUT] the length of source data buffer; after
|
||||
* conversion will contain the number of Unicode
|
||||
* characters read
|
||||
* @param aDest [OUT] the destination data buffer
|
||||
* @param aDestLength [IN/OUT] the length of the destination data buffer;
|
||||
* after conversion will contain the number of bytes
|
||||
* written
|
||||
* @return NS_OK_UENC_MOREOUTPUT if only a partial conversion
|
||||
* was done; more output space is needed to continue
|
||||
* NS_ERROR_UENC_NOMAPPING if character without mapping
|
||||
* was encountered and the behavior was set to "signal".
|
||||
*/
|
||||
NS_IMETHOD Convert(const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
||||
char * aDest, PRInt32 * aDestLength) = 0;
|
||||
|
||||
/**
|
||||
* Finishes the conversion. The converter has the possibility to write some
|
||||
* extra data and flush its final state.
|
||||
*
|
||||
* @param aDest [OUT] the destination data buffer
|
||||
* @param aDestLength [IN/OUT] the length of destination data buffer; after
|
||||
* conversion it will contain the number of bytes written
|
||||
* @return NS_OK_UENC_MOREOUTPUT if only a partial conversion
|
||||
* was done; more output space is needed to continue
|
||||
*/
|
||||
NS_IMETHOD Finish(char * aDest, PRInt32 * aDestLength) = 0;
|
||||
|
||||
/**
|
||||
* Returns a quick estimation of the size of the buffer needed to hold the
|
||||
* converted data. Remember: this estimation is >= with the actual size of
|
||||
* the buffer needed. It will be computed for the "worst case"
|
||||
*
|
||||
* @param aSrc [IN] the source data buffer
|
||||
* @param aSrcLength [IN] the length of source data buffer
|
||||
* @param aDestLength [OUT] the needed size of the destination buffer
|
||||
* @return NS_OK_UENC_EXACTLENGTH if an exact length was computed
|
||||
* NS_OK if all we have is an approximation
|
||||
*/
|
||||
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength) = 0;
|
||||
|
||||
/**
|
||||
* Resets the charset converter so it may be recycled for a completely
|
||||
* different and urelated buffer of data.
|
||||
*/
|
||||
NS_IMETHOD Reset() = 0;
|
||||
|
||||
/**
|
||||
* Specify what to do when a character cannot be mapped into the dest charset
|
||||
*
|
||||
* @param aOrder [IN] the behavior; taken from the enum
|
||||
*/
|
||||
NS_IMETHOD SetOutputErrorBehavior(PRInt32 aBehavior,
|
||||
nsIUnicharEncoder * aEncoder, PRUnichar aChar) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIUnicodeEncoder_h___ */
|
||||
@@ -1,120 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* jeroen.dobbelaere@acunia.com
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef __UCONV_TIL_H__
|
||||
#define __UCONV_TIL_H__
|
||||
|
||||
#include "prcpucfg.h"
|
||||
|
||||
|
||||
/*=====================================*/
|
||||
#define PACK(h,l) (int16)(( (h) << 8) | (l))
|
||||
|
||||
#if defined(IS_LITTLE_ENDIAN)
|
||||
#define ShiftCell(sub,len,min,max,minh,minl,maxh,maxl) \
|
||||
PACK(len,sub), PACK(max,min), PACK(minl,minh), PACK(maxl,maxh)
|
||||
#else
|
||||
#define ShiftCell(sub,len,min,max,minh,minl,maxh,maxl) \
|
||||
PACK(sub,len), PACK(min, max), PACK(minh,minl), PACK(maxh,maxl)
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
u1ByteCharset = 0,
|
||||
u2BytesCharset,
|
||||
uMultibytesCharset,
|
||||
u2BytesGRCharset,
|
||||
u2BytesGRPrefix8FCharset,
|
||||
u2BytesGRPrefix8EA2Charset,
|
||||
u2BytesSwapCharset,
|
||||
u4BytesCharset,
|
||||
u4BytesSwapCharset,
|
||||
u2BytesGRPrefix8EA3Charset,
|
||||
u2BytesGRPrefix8EA4Charset,
|
||||
u2BytesGRPrefix8EA5Charset,
|
||||
u2BytesGRPrefix8EA6Charset,
|
||||
u2BytesGRPrefix8EA7Charset,
|
||||
u1ByteGLCharset,
|
||||
uDecomposedHangulCharset,
|
||||
uDecomposedHangulGLCharset,
|
||||
uJohabHangulCharset,
|
||||
uJohabSymbolCharset,
|
||||
u4BytesGB18030Charset,
|
||||
u2BytesGR128Charset,
|
||||
uNumOfCharsetType
|
||||
} uScanClassID;
|
||||
|
||||
typedef enum {
|
||||
u1ByteChar = 0,
|
||||
u2BytesChar,
|
||||
u2BytesGRChar,
|
||||
u1BytePrefix8EChar, /* Used by JIS0201 GR in EUC_JP */
|
||||
u2BytesUTF8, /* Used by UTF8 */
|
||||
u3BytesUTF8, /* Used by UTF8 */
|
||||
uNumOfCharType
|
||||
} uScanSubClassID;
|
||||
|
||||
typedef struct {
|
||||
unsigned char classID;
|
||||
unsigned char reserveLen;
|
||||
unsigned char shiftin_Min;
|
||||
unsigned char shiftin_Max;
|
||||
unsigned char shiftout_MinHB;
|
||||
unsigned char shiftout_MinLB;
|
||||
unsigned char shiftout_MaxHB;
|
||||
unsigned char shiftout_MaxLB;
|
||||
} uShiftCell;
|
||||
|
||||
typedef struct {
|
||||
PRInt16 numOfItem;
|
||||
PRInt16 classID;
|
||||
uShiftCell shiftcell[1];
|
||||
} uShiftTable;
|
||||
|
||||
/*=====================================*/
|
||||
|
||||
typedef struct {
|
||||
unsigned char min;
|
||||
unsigned char max;
|
||||
} uRange;
|
||||
|
||||
/*=====================================*/
|
||||
|
||||
typedef PRUint16* uMappingTable;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/* -*- 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 */
|
||||
@@ -1,88 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/*========================================================
|
||||
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 */
|
||||
@@ -1,166 +0,0 @@
|
||||
#
|
||||
# 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):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = uconv
|
||||
LIBRARY_NAME = uconv
|
||||
EXPORT_LIBRARY = 1
|
||||
IS_COMPONENT = 1
|
||||
MODULE_NAME = nsUConvModule
|
||||
|
||||
ifneq ($(OS_ARCH),WINNT)
|
||||
# To avoid conflict with OS/2 system uconv.dll
|
||||
SHORT_LIBNAME = mozuconv
|
||||
endif
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
intl \
|
||||
locale \
|
||||
unicharutil \
|
||||
chardet \
|
||||
$(NULL)
|
||||
|
||||
CSRCS = \
|
||||
ugen.c \
|
||||
uscan.c \
|
||||
umap.c \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsCharsetConverterManager.cpp \
|
||||
nsTextToSubURI.cpp \
|
||||
nsUnicodeDecodeHelper.cpp \
|
||||
nsUnicodeEncodeHelper.cpp \
|
||||
nsCharsetAliasImp.cpp \
|
||||
nsURLProperties.cpp \
|
||||
nsMappingCache.cpp \
|
||||
nsUConvModule.cpp \
|
||||
nsISO88591ToUnicode.cpp \
|
||||
nsCP1252ToUnicode.cpp \
|
||||
nsMacRomanToUnicode.cpp \
|
||||
nsUTF8ToUnicode.cpp \
|
||||
nsUnicodeToISO88591.cpp \
|
||||
nsUnicodeToCP1252.cpp \
|
||||
nsUnicodeToMacRoman.cpp \
|
||||
nsUnicodeToUTF8.cpp \
|
||||
nsScriptableUConv.cpp \
|
||||
nsConverterInputStream.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORT_RESOURCE = \
|
||||
charsetalias.properties \
|
||||
charsetData.properties \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||
CPPSRCS += nsOS2Charset.cpp
|
||||
EXPORT_RESOURCE += os2charset.properties
|
||||
else
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
CPPSRCS += nsWinCharset.cpp
|
||||
EXPORT_RESOURCE += wincharset.properties
|
||||
else
|
||||
ifneq (,$(filter cocoa mac, $(MOZ_WIDGET_TOOLKIT)))
|
||||
CPPSRCS += nsMacCharset.cpp
|
||||
EXPORT_RESOURCE += maccharset.properties
|
||||
else
|
||||
CPPSRCS += nsUNIXCharset.cpp
|
||||
EXPORT_RESOURCE += unixcharset.properties
|
||||
# add platform charset remapping properties files here if necessary
|
||||
# (see unixcharset.sample.properties for an example file)
|
||||
# eg: if we needed a charset remap for OSARCH=Linux then add the following line:
|
||||
#EXPORT_RESOURCE += unixcharset.Linux.properties
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
EXTRA_DSO_LDOPTS = $(MOZ_NECKO_UTIL_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(MOZ_UNICHARUTIL_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||
ifeq ($(MOZ_OS2_TOOLS),VACPP)
|
||||
OS_LIBS += libuls.lib
|
||||
else
|
||||
OS_LIBS += -llibuni
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter cocoa mac, $(MOZ_WIDGET_TOOLKIT)))
|
||||
EXTRA_DSO_LDOPTS += $(TK_LIBS)
|
||||
endif
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir)/../util \
|
||||
-I$(srcdir)/../ucvlatin \
|
||||
-I$(srcdir)/../ucvibm \
|
||||
-I$(srcdir)/../ucvja \
|
||||
-I$(srcdir)/../ucvtw2 \
|
||||
-I$(srcdir)/../ucvtw \
|
||||
-I$(srcdir)/../ucvko \
|
||||
-I$(srcdir)/../ucvcn \
|
||||
$(NULL)
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)ucvutil_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)ucvlatin_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)ucvibm_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)ucvutil_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)ucvja_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)ucvtw2_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)ucvtw_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)ucvko_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)ucvcn_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
CFLAGS += -DUSE_NSREG -D_IMPL_NS_INTL
|
||||
|
||||
# Reserved name __STDC__ cannot be defined as a macro name on AIX or OpenVMS.
|
||||
# QNX simply objects to the way it's being redefined.
|
||||
ifeq (,$(filter AIX OpenVMS QNX HP-UX,$(OS_ARCH)))
|
||||
CFLAGS += -D__STDC__
|
||||
endif
|
||||
|
||||
# CODESET is not automatically defined on some older versions of Redhat.
|
||||
# Define _XOPEN_SOURCE so CODESET will get defined and thus allow
|
||||
# nl_langinfo(CODESET) to compile on these systems.
|
||||
ifeq ($(OS_ARCH), Linux)
|
||||
DEFINES += -D_XOPEN_SOURCE=500
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
DEFINES += -DWIN32_LEAN_AND_MEAN
|
||||
endif
|
||||
|
||||
libs:: $(EXPORT_RESOURCE)
|
||||
$(INSTALL) $^ $(DIST)/bin/res
|
||||
|
||||
install:: $(EXPORT_RESOURCE)
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/res
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
##
|
||||
## 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) 1999 Netscape Communications Corporation. All
|
||||
## Rights Reserved.
|
||||
##
|
||||
## Contributor(s):
|
||||
|
||||
## Rule of this file:
|
||||
## 1. key should always be in lower case ascii so we can do case insensitive
|
||||
## comparison in the code faster.
|
||||
|
||||
## Format of this file:
|
||||
##
|
||||
## charset_name.notForBrowser = anything - specifies that this charset is
|
||||
## not to be used in the browser
|
||||
##
|
||||
## charset_name.LangGroup =
|
||||
##
|
||||
## charset_name.MIMEHeaderEncodingMethod =
|
||||
##
|
||||
## charset_name.MIMEMailCharset =
|
||||
##
|
||||
## charset_name.isMultibyte = multi byte charsets
|
||||
|
||||
t.61-8bit.notForBrowser = true
|
||||
utf-32le.notForBrowser = true
|
||||
utf-32be.notForBrowser = true
|
||||
utf-16le.notForBrowser = true
|
||||
utf-16be.notForBrowser = true
|
||||
x-imap4-modified-utf7.notForBrowser = true
|
||||
x-u-escaped.notForBrowser = true
|
||||
windows-936.notForBrowser = true
|
||||
us-ascii.notForBrowser = true
|
||||
x-obsoleted-euc-jp.notForBrowser = true
|
||||
x-obsoleted-iso-2022-jp.notForBrowser = true
|
||||
x-obsoleted-shift_jis.notForBrowser = true
|
||||
iso-8859-6-e.notForBrowser = true
|
||||
iso-8859-6-i.notForBrowser = true
|
||||
ibm864i.notForBrowser = true
|
||||
iso-8859-8-e.notForBrowser = true
|
||||
|
||||
|
||||
adobe-symbol-encoding.LangGroup = el
|
||||
big5.LangGroup = zh-TW
|
||||
big5-hkscs.LangGroup = zh-TW
|
||||
euc-jp.LangGroup = ja
|
||||
euc-kr.LangGroup = ko
|
||||
gb2312.LangGroup = zh-CN
|
||||
gb18030.LangGroup = zh-CN
|
||||
gb18030.2000-0.LangGroup = zh-CN
|
||||
gb18030.2000-1.LangGroup = zh-CN
|
||||
hkscs-1.LangGroup = zh-TW
|
||||
hz-gb-2312.LangGroup = zh-CN
|
||||
ibm850.LangGroup = x-western
|
||||
ibm852.LangGroup = x-central-euro
|
||||
ibm855.LangGroup = x-cyrillic
|
||||
ibm857.LangGroup = tr
|
||||
ibm862.LangGroup = he
|
||||
ibm864.LangGroup = ar
|
||||
ibm866.LangGroup = x-cyrillic
|
||||
iso-2022-cn.LangGroup = zh-CN
|
||||
iso-2022-jp.LangGroup = ja
|
||||
iso-2022-kr.LangGroup = ko
|
||||
iso-8859-1.LangGroup = x-western
|
||||
iso-8859-15.LangGroup = x-western
|
||||
iso-8859-2.LangGroup = x-central-euro
|
||||
iso-8859-4.LangGroup = x-baltic
|
||||
iso-8859-13.LangGroup = x-baltic
|
||||
iso-8859-5.LangGroup = x-cyrillic
|
||||
iso-8859-6.LangGroup = ar
|
||||
iso-8859-6-e.LangGroup = ar
|
||||
iso-8859-6-i.LangGroup = ar
|
||||
iso-8859-7.LangGroup = el
|
||||
iso-8859-8.LangGroup = he
|
||||
iso-8859-8-e.LangGroup = he
|
||||
iso-8859-8-i.LangGroup = he
|
||||
iso-8859-9.LangGroup = tr
|
||||
jis_0208-1983.LangGroup = ja
|
||||
koi8-r.LangGroup = x-cyrillic
|
||||
koi8-u.LangGroup = x-cyrillic
|
||||
shift_jis.LangGroup = ja
|
||||
tis-620.LangGroup = th
|
||||
tis620-2.LangGroup = th
|
||||
us-ascii.LangGroup = x-western
|
||||
utf-16be.LangGroup = x-unicode
|
||||
utf-16le.LangGroup = x-unicode
|
||||
utf-32be.LangGroup = x-unicode
|
||||
utf-32le.LangGroup = x-unicode
|
||||
utf-7.LangGroup = x-unicode
|
||||
utf-8.LangGroup = x-unicode
|
||||
windows-1250.LangGroup = x-central-euro
|
||||
windows-1251.LangGroup = x-cyrillic
|
||||
windows-1252.LangGroup = x-western
|
||||
windows-1253.LangGroup = el
|
||||
windows-1254.LangGroup = tr
|
||||
windows-1255.LangGroup = he
|
||||
windows-1256.LangGroup = ar
|
||||
windows-1257.LangGroup = x-baltic
|
||||
windows-936.LangGroup = zh-CN
|
||||
x-cns-11643-1.LangGroup = zh-TW
|
||||
x-euc-tw.LangGroup = zh-TW
|
||||
x-gbk.LangGroup = zh-CN
|
||||
x-gbk-noascii.LangGroup = zh-CN
|
||||
x-mac-ce.LangGroup = x-central-euro
|
||||
x-mac-cyrillic.LangGroup = x-cyrillic
|
||||
x-mac-greek.LangGroup = el
|
||||
x-mac-icelandic.LangGroup = x-western
|
||||
x-mac-roman.LangGroup = x-western
|
||||
x-mac-turkish.LangGroup = tr
|
||||
x-mac-ukrainian.LangGroup = x-cyrillic
|
||||
x-user-defined.LangGroup = x-user-def
|
||||
x-x11johab.LangGroup = ko
|
||||
x-johab.LangGroup = ko
|
||||
x-johab-noascii.LangGroup = ko
|
||||
x-windows-949.LangGroup = ko
|
||||
x-mac-hebrew.LangGroup = he
|
||||
x-mac-arabic.LangGroup = ar
|
||||
|
||||
utf-8.MIMEHeaderEncodingMethod = B
|
||||
utf-8.MIMEMailCharset = utf-8
|
||||
|
||||
|
||||
iso-2022-jp.isMultibyte = true
|
||||
shift_jis.isMultibyte = true
|
||||
euc-jp.isMultibyte = true
|
||||
big5.isMultibyte = true
|
||||
big5-hkscs.isMultibyte = true
|
||||
x-euc-tw.isMultibyte = true
|
||||
gb2312.isMultibyte = true
|
||||
hz-gb-2312.isMultibyte = true
|
||||
iso-2022-kr.isMultibyte = true
|
||||
euc-kr.isMultibyte = true
|
||||
x-johab.isMultibyte = true
|
||||
x-windows-949.isMultibyte = true
|
||||
utf-7.isMultibyte = true
|
||||
utf-8.isMultibyte = true
|
||||
@@ -1,118 +0,0 @@
|
||||
##
|
||||
## 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) 1999 Netscape Communications Corporation. All
|
||||
## Rights Reserved.
|
||||
##
|
||||
## Contributor(s):
|
||||
|
||||
## Rule of this file:
|
||||
## 1. key should always be in lower case ascii so we can do case insensitive
|
||||
## comparison in the code faster.
|
||||
|
||||
## Format of this file:
|
||||
## charset_name.title = a_title - specifies the human readable title for
|
||||
## this charset
|
||||
|
||||
us-ascii.title = English (US-ASCII)
|
||||
iso-8859-1.title = Western (ISO-8859-1)
|
||||
iso-8859-2.title = Central European (ISO-8859-2)
|
||||
iso-8859-3.title = South European (ISO-8859-3)
|
||||
iso-8859-4.title = Baltic (ISO-8859-4)
|
||||
iso-8859-9.title = Turkish (ISO-8859-9)
|
||||
iso-8859-10.title = Nordic (ISO-8859-10)
|
||||
iso-8859-13.title = Baltic (ISO-8859-13)
|
||||
iso-8859-14.title = Celtic (ISO-8859-14)
|
||||
iso-8859-15.title = Western (ISO-8859-15)
|
||||
iso-8859-16.title = Romanian (ISO-8859-16)
|
||||
windows-1250.title = Central European (Windows-1250)
|
||||
windows-1252.title = Western (Windows-1252)
|
||||
windows-1254.title = Turkish (Windows-1254)
|
||||
windows-1257.title = Baltic (Windows-1257)
|
||||
x-mac-roman.title = Western (MacRoman)
|
||||
x-mac-ce.title = Central European (MacCE)
|
||||
x-mac-turkish.title = Turkish (MacTurkish)
|
||||
x-mac-croatian.title = Croatian (MacCroatian)
|
||||
x-mac-romanian.title = Romanian (MacRomanian)
|
||||
x-mac-icelandic.title = Icelandic (MacIcelandic)
|
||||
iso-2022-jp.title = Japanese (ISO-2022-JP)
|
||||
shift_jis.title = Japanese (Shift_JIS)
|
||||
euc-jp.title = Japanese (EUC-JP)
|
||||
big5.title = Chinese Traditional (Big5)
|
||||
big5-hkscs.title = Chinese Traditional (Big5-HKSCS)
|
||||
x-euc-tw.title = Chinese Traditional (EUC-TW)
|
||||
gb2312.title = Chinese Simplified (GB2312)
|
||||
hz-gb-2312.title = Chinese Simplified (HZ)
|
||||
x-gbk.title = Chinese Simplified (GBK)
|
||||
iso-2022-cn.title = Chinese Simplified (ISO-2022-CN)
|
||||
euc-kr.title = Korean (EUC-KR)
|
||||
x-johab.title = Korean (JOHAB)
|
||||
x-windows-949.title = Korean (UHC)
|
||||
iso-2022-kr.title = Korean (ISO-2022-KR)
|
||||
utf-7.title = Unicode (UTF-7)
|
||||
utf-8.title = Unicode (UTF-8)
|
||||
iso-8859-5.title = Cyrillic (ISO-8859-5)
|
||||
iso-ir-111.title = Cyrillic (ISO-IR-111)
|
||||
windows-1251.title = Cyrillic (Windows-1251)
|
||||
x-mac-cyrillic.title = Cyrillic (MacCyrillic)
|
||||
x-mac-ukrainian.title = Cyrillic/Ukrainian (MacUkrainian)
|
||||
koi8-r.title = Cyrillic (KOI8-R)
|
||||
koi8-u.title = Cyrillic/Ukrainian (KOI8-U)
|
||||
iso-8859-7.title = Greek (ISO-8859-7)
|
||||
windows-1253.title = Greek (Windows-1253)
|
||||
x-mac-greek.title = Greek (MacGreek)
|
||||
windows-1258.title = Vietnamese (Windows-1258)
|
||||
x-viet-tcvn5712.title = Vietnamese (TCVN)
|
||||
viscii.title = Vietnamese (VISCII)
|
||||
x-viet-vps.title = Vietnamese (VPS)
|
||||
geostd8.title = Georgian (GEOSTD8)
|
||||
tis-620.title = Thai (TIS-620)
|
||||
armscii-8.title = Armenian (ARMSCII-8)
|
||||
iso-8859-6.title = Arabic (ISO-8859-6)
|
||||
iso-8859-6-i.title = Arabic (ISO-8859-6-I)
|
||||
iso-8859-6-e.title = Arabic (ISO-8859-6-E)
|
||||
iso-8859-8.title = Hebrew Visual (ISO-8859-8)
|
||||
iso-8859-8-i.title = Hebrew (ISO-8859-8-I)
|
||||
iso-8859-8-e.title = Hebrew (ISO-8859-8-E)
|
||||
windows-1255.title = Hebrew (Windows-1255)
|
||||
windows-1256.title = Arabic (Windows-1256)
|
||||
x-user-defined.title = User Defined
|
||||
ibm866.title = Cyrillic/Russian (CP-866)
|
||||
ibm850.title = Western (IBM-850)
|
||||
ibm852.title = Central European (IBM-852)
|
||||
ibm855.title = Cyrillic (IBM-855)
|
||||
ibm857.title = Turkish (IBM-857)
|
||||
ibm862.title = Hebrew (IBM-862)
|
||||
ibm864.title = Arabic (IBM-864)
|
||||
ibm864i.title = Arabic (IBM-864-I)
|
||||
gb18030.title = Chinese Simplified (GB18030)
|
||||
x-mac-arabic.title = Arabic (MacArabic)
|
||||
x-mac-farsi.title = Farsi (MacFarsi)
|
||||
x-mac-hebrew.title = Hebrew (MacHebrew)
|
||||
x-mac-devanagari.title = Hindi (MacDevanagari)
|
||||
x-mac-gujarati.title = Gujarati (MacGujarati)
|
||||
x-mac-gurmukhi.title = Gurmukhi (MacGurmukhi)
|
||||
|
||||
chardet.off.title = (Off)
|
||||
chardet.alis_charset_detector.title = All
|
||||
chardet.universal_charset_detector.title = Universal
|
||||
chardet.ja_parallel_state_machine.title = Japanese
|
||||
chardet.ko_parallel_state_machine.title = Korean
|
||||
chardet.zhtw_parallel_state_machine.title = Traditional Chinese
|
||||
chardet.zhcn_parallel_state_machine.title = Simplified Chinese
|
||||
chardet.zh_parallel_state_machine.title = Chinese
|
||||
chardet.cjk_parallel_state_machine.title = East Asian
|
||||
chardet.ruprob.title = Russian
|
||||
chardet.ukprob.title = Ukrainian
|
||||
@@ -1,493 +0,0 @@
|
||||
##
|
||||
## 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) 1999 Netscape Communications Corporation. All
|
||||
## Rights Reserved.
|
||||
##
|
||||
## Contributor(s):
|
||||
## IBM Corporation
|
||||
##
|
||||
## This Original Code has been modified by IBM Corporation.
|
||||
## Modifications made by IBM described herein are
|
||||
## Copyright (c) International Business Machines
|
||||
## Corporation, 1999
|
||||
##
|
||||
## Modifications to Mozilla code or documentation
|
||||
## identified per MPL Section 3.3
|
||||
##
|
||||
## Date Modified by Description of modification
|
||||
## 12/09/1999 IBM Corp. Support for IBM codepages - 850,852,855,857,862,864
|
||||
##
|
||||
## Rule of this file:
|
||||
## 1. key should always be in lower case ascii so we can do case insensitive
|
||||
## comparison in the code faster.
|
||||
## 2. value should be the one used in unicode converter
|
||||
## 3. If you want to add more charset, mailto:ftang@netscape.com
|
||||
##
|
||||
## 4. If the charset is not used for document charset, but font charset
|
||||
## (e.g. XLFD charset- such as JIS x0201, JIS x0208), don't put here
|
||||
##
|
||||
us-ascii=us-ascii
|
||||
ansi_x3.4-1968=us-ascii
|
||||
646=us-ascii
|
||||
iso-8859-1=ISO-8859-1
|
||||
iso-8859-2=ISO-8859-2
|
||||
iso-8859-3=ISO-8859-3
|
||||
iso-8859-4=ISO-8859-4
|
||||
iso-8859-5=ISO-8859-5
|
||||
iso-8859-6=ISO-8859-6
|
||||
iso-8859-6-i=ISO-8859-6-I
|
||||
iso-8859-6-e=ISO-8859-6-E
|
||||
iso-8859-7=ISO-8859-7
|
||||
iso-8859-8=ISO-8859-8
|
||||
iso-8859-8-i=ISO-8859-8-I
|
||||
iso-8859-8-e=ISO-8859-8-E
|
||||
iso-8859-9=ISO-8859-9
|
||||
iso-8859-10=ISO-8859-10
|
||||
iso-8859-11=TIS-620
|
||||
iso-8859-13=ISO-8859-13
|
||||
iso-8859-14=ISO-8859-14
|
||||
iso-8859-15=ISO-8859-15
|
||||
iso-8859-16=ISO-8859-16
|
||||
iso-ir-111=ISO-IR-111
|
||||
iso-2022-cn=ISO-2022-CN
|
||||
iso-2022-kr=ISO-2022-KR
|
||||
iso-2022-jp=ISO-2022-JP
|
||||
utf-32be=UTF-32BE
|
||||
utf-32le=UTF-32LE
|
||||
utf-32=UTF-32BE
|
||||
utf-16be=UTF-16BE
|
||||
utf-16le=UTF-16LE
|
||||
utf-16=UTF-16BE
|
||||
windows-1250=windows-1250
|
||||
windows-1251=windows-1251
|
||||
windows-1252=windows-1252
|
||||
windows-1253=windows-1253
|
||||
windows-1254=windows-1254
|
||||
windows-1255=windows-1255
|
||||
windows-1256=windows-1256
|
||||
windows-1257=windows-1257
|
||||
windows-1258=windows-1258
|
||||
ibm866=IBM866
|
||||
ibm850=IBM850
|
||||
ibm852=IBM852
|
||||
ibm855=IBM855
|
||||
ibm857=IBM857
|
||||
ibm862=IBM862
|
||||
ibm864=IBM864
|
||||
ibm864i=IBM864i
|
||||
utf-8=UTF-8
|
||||
utf-7=UTF-7
|
||||
shift_jis=Shift_JIS
|
||||
big5=Big5
|
||||
euc-jp=EUC-JP
|
||||
euc-kr=EUC-KR
|
||||
gb2312=GB2312
|
||||
gb18030=gb18030
|
||||
viscii=VISCII
|
||||
koi8-r=KOI8-R
|
||||
koi8-u=KOI8-U
|
||||
tis-620=TIS-620
|
||||
t.61-8bit=T.61-8bit
|
||||
hz-gb-2312=HZ-GB-2312
|
||||
big5-hkscs=Big5-HKSCS
|
||||
gbk=x-gbk
|
||||
cns11643=x-euc-tw
|
||||
##
|
||||
## Netscape private ...
|
||||
##
|
||||
x-imap4-modified-utf7=x-imap4-modified-utf7
|
||||
x-euc-tw=x-euc-tw
|
||||
x-mac-roman=x-mac-roman
|
||||
x-mac-ce=x-mac-ce
|
||||
x-mac-turkish=x-mac-turkish
|
||||
x-mac-greek=x-mac-greek
|
||||
x-mac-icelandic=x-mac-icelandic
|
||||
x-mac-croatian=x-mac-croatian
|
||||
x-mac-romanian=x-mac-romanian
|
||||
x-mac-cyrillic=x-mac-cyrillic
|
||||
x-mac-ukrainian=x-mac-ukrainian
|
||||
x-mac-hebrew=x-mac-hebrew
|
||||
x-mac-arabic=x-mac-arabic
|
||||
geostd8=GEOSTD8
|
||||
armscii-8=armscii-8
|
||||
x-viet-tcvn5712=x-viet-tcvn5712
|
||||
x-viet-vps=x-viet-vps
|
||||
x-viet-vni=x-viet-vni
|
||||
iso-10646-ucs-2=UTF-16BE
|
||||
x-iso-10646-ucs-2-be=UTF-16BE
|
||||
x-iso-10646-ucs-2-le=UTF-16LE
|
||||
iso-10646-ucs-4=UTF-32BE
|
||||
x-iso-10646-ucs-4-be=UTF-32BE
|
||||
x-iso-10646-ucs-4-le=UTF-32LE
|
||||
x-user-defined=x-user-defined
|
||||
x-u-escaped=x-u-escaped
|
||||
x-johab=x-johab
|
||||
x-windows-949=x-windows-949
|
||||
##
|
||||
## Aliases for ISO-8859-1
|
||||
##
|
||||
latin1=ISO-8859-1
|
||||
iso_8859-1=ISO-8859-1
|
||||
iso8859-1=ISO-8859-1
|
||||
iso8859-2=ISO-8859-2
|
||||
iso8859-3=ISO-8859-3
|
||||
iso8859-4=ISO-8859-4
|
||||
iso8859-5=ISO-8859-5
|
||||
iso8859-6=ISO-8859-6
|
||||
iso8859-7=ISO-8859-7
|
||||
iso8859-8=ISO-8859-8
|
||||
iso8859-9=ISO-8859-9
|
||||
iso8859-10=ISO-8859-10
|
||||
iso8859-11=TIS-620
|
||||
iso8859-13=ISO-8859-13
|
||||
iso8859-14=ISO-8859-14
|
||||
iso8859-15=ISO-8859-15
|
||||
# Currently .properties cannot handle : in key
|
||||
# iso_8859-1:1987=ISO-8859-1
|
||||
iso-ir-100=ISO-8859-1
|
||||
l1=ISO-8859-1
|
||||
ibm819=ISO-8859-1
|
||||
cp819=ISO-8859-1
|
||||
csisolatin1=ISO-8859-1
|
||||
##
|
||||
## Aliases for ISO-8859-2
|
||||
##
|
||||
latin2=ISO-8859-2
|
||||
iso_8859-2=ISO-8859-2
|
||||
# Currently .properties cannot handle : in key
|
||||
# iso_8859-2:1987=ISO-8859-2
|
||||
iso-ir-101=ISO-8859-2
|
||||
l2=ISO-8859-2
|
||||
csisolatin2=ISO-8859-2
|
||||
##
|
||||
## Aliases for ISO-8859-3
|
||||
##
|
||||
latin3=ISO-8859-3
|
||||
iso_8859-3=ISO-8859-3
|
||||
# Currently .properties cannot handle : in key
|
||||
#iso_8859-3:1988=ISO-8859-3
|
||||
iso-ir-109=ISO-8859-3
|
||||
l3=ISO-8859-3
|
||||
csisolatin3=ISO-8859-3
|
||||
##
|
||||
## Aliases for ISO-8859-4
|
||||
##
|
||||
latin4=ISO-8859-4
|
||||
iso_8859-4=ISO-8859-4
|
||||
# Currently .properties cannot handle : in key
|
||||
#iso_8859-4:1988=ISO-8859-4
|
||||
iso-ir-110=ISO-8859-4
|
||||
l4=ISO-8859-4
|
||||
csisolatin4=ISO-8859-4
|
||||
##
|
||||
## Aliases for ISO-8859-5
|
||||
##
|
||||
cyrillic=ISO-8859-5
|
||||
iso_8859-5=ISO-8859-5
|
||||
# Currently .properties cannot handle : in key
|
||||
#iso_8859-5:1988=ISO-8859-5
|
||||
iso-ir-144=ISO-8859-5
|
||||
csisolatincyrillic=ISO-8859-5
|
||||
##
|
||||
## Aliases for ISO-8859-6
|
||||
##
|
||||
arabic=ISO-8859-6
|
||||
iso_8859-6=ISO-8859-6
|
||||
# Currently .properties cannot handle : in key
|
||||
#iso_8859-6:1987=ISO-8859-6
|
||||
iso-ir-127=ISO-8859-6
|
||||
ecma-114=ISO-8859-6
|
||||
asmo-708=ISO-8859-6
|
||||
csisolatinarabic=ISO-8859-6
|
||||
##
|
||||
## Aliases for ISO-8859-6-I
|
||||
##
|
||||
csiso88596i=ISO-8859-6-I
|
||||
##
|
||||
## Aliases for ISO-8859-6-E
|
||||
##
|
||||
csiso88596e=ISO-8859-6-E
|
||||
##
|
||||
## Aliases for ISO-8859-7
|
||||
##
|
||||
greek=ISO-8859-7
|
||||
greek8=ISO-8859-7
|
||||
sun_eu_greek=ISO-8859-7
|
||||
iso_8859-7=ISO-8859-7
|
||||
# Currently .properties cannot handle : in key
|
||||
#iso_8859-7:1987=ISO-8859-7
|
||||
iso-ir-126=ISO-8859-7
|
||||
elot_928=ISO-8859-7
|
||||
ecma-118=ISO-8859-7
|
||||
csisolatingreek=ISO-8859-7
|
||||
##
|
||||
## Aliases for ISO-8859-8
|
||||
##
|
||||
hebrew=ISO-8859-8
|
||||
iso_8859-8=ISO-8859-8
|
||||
visual=ISO-8859-8
|
||||
# Currently .properties cannot handle : in key
|
||||
#iso_8859-8:1988=ISO-8859-8
|
||||
iso-ir-138=ISO-8859-8
|
||||
csisolatinhebrew=ISO-8859-8
|
||||
##
|
||||
## Aliases for ISO-8859-8-I
|
||||
##
|
||||
csiso88598i=ISO-8859-8-I
|
||||
iso-8859-8i=ISO-8859-8-I
|
||||
##
|
||||
## Aliases for ISO-8859-8-E
|
||||
##
|
||||
csiso88598e=ISO-8859-8-E
|
||||
##
|
||||
## Aliases for ISO-8859-9
|
||||
##
|
||||
latin5=ISO-8859-9
|
||||
iso_8859-9=ISO-8859-9
|
||||
# Currently .properties cannot handle : in key
|
||||
#iso_8859-9:1989=ISO-8859-9
|
||||
iso-ir-148=ISO-8859-9
|
||||
l5=ISO-8859-9
|
||||
csisolatin5=ISO-8859-9
|
||||
##
|
||||
## Aliases for UTF-8
|
||||
##
|
||||
unicode-1-1-utf-8=UTF-8
|
||||
##
|
||||
## Aliases for Shift_JIS
|
||||
##
|
||||
x-sjis=Shift_JIS
|
||||
shift-jis=Shift_JIS
|
||||
ms_kanji=Shift_JIS
|
||||
csshiftjis=Shift_JIS
|
||||
windows-31j=Shift_JIS
|
||||
##
|
||||
## Aliases for EUC_JP
|
||||
##
|
||||
cseucjpkdfmtjapanese=EUC-JP
|
||||
x-euc-jp=EUC-JP
|
||||
##
|
||||
## Aliases for ISO-2022-JP
|
||||
##
|
||||
csiso2022jp=ISO-2022-JP
|
||||
# The following are really not aliases ISO-2022-JP, but sharing the same decoder
|
||||
iso-2022-jp-2=ISO-2022-JP
|
||||
csiso2022jp2=ISO-2022-JP
|
||||
##
|
||||
## Aliases for Big5
|
||||
##
|
||||
csbig5=Big5
|
||||
# x-x-big5 is not really a alias for Big5, add it only for MS FrontPage
|
||||
x-x-big5=Big5
|
||||
# Sun Solaris
|
||||
zh_tw-big5=Big5
|
||||
##
|
||||
## Aliases for EUC-KR
|
||||
##
|
||||
csueckr=EUC-KR
|
||||
# The following are really not aliases EUC-KR, add them only for MS FrontPage
|
||||
#ks_c_5601-1987=EUC-KR
|
||||
iso-ir-149=EUC-KR
|
||||
ks_c_5601-1989=EUC-KR
|
||||
ksc_5601=EUC-KR
|
||||
ksc5601=EUC-KR
|
||||
korean=EUC-KR
|
||||
csksc56011987=EUC-KR
|
||||
5601=EUC-KR
|
||||
##
|
||||
## Aliases for X-Windows-949, CP949, Unified Hangul Code (UHC)
|
||||
##
|
||||
# Microsoft uses ks_c_5601-1987 to mean Windows-949 or its subset EUC-KR.
|
||||
ks_c_5601-1987=x-windows-949
|
||||
##
|
||||
## Aliases for GB2312
|
||||
##
|
||||
# The following are really not aliases GB2312, add them only for MS FrontPage
|
||||
gb_2312-80=GB2312
|
||||
iso-ir-58=GB2312
|
||||
chinese=GB2312
|
||||
csiso58gb231280=GB2312
|
||||
csgb2312=GB2312
|
||||
zh_cn.euc=GB2312
|
||||
# Sun Solaris
|
||||
gb_2312=GB2312
|
||||
##
|
||||
## Aliases for windows-125x
|
||||
##
|
||||
x-cp1250=windows-1250
|
||||
x-cp1251=windows-1251
|
||||
x-cp1252=windows-1252
|
||||
x-cp1253=windows-1253
|
||||
x-cp1254=windows-1254
|
||||
x-cp1255=windows-1255
|
||||
x-cp1256=windows-1256
|
||||
x-cp1257=windows-1257
|
||||
x-cp1258=windows-1258
|
||||
##
|
||||
## Aliases for windows-874
|
||||
##
|
||||
windows-874=TIS-620
|
||||
ibm874=TIS-620
|
||||
tis620.2533=TIS-620
|
||||
##
|
||||
## Aliases for IBM866
|
||||
##
|
||||
cp866=IBM866
|
||||
cp-866=IBM866
|
||||
866=IBM866
|
||||
csIBM866=IBM866
|
||||
##
|
||||
## Aliases for IBM850
|
||||
##
|
||||
cp850=IBM850
|
||||
850=IBM850
|
||||
csIBM850=IBM850
|
||||
##
|
||||
## Aliases for IBM852
|
||||
##
|
||||
cp852=IBM852
|
||||
852=IBM852
|
||||
csIBM852=IBM852
|
||||
##
|
||||
## Aliases for IBM855
|
||||
##
|
||||
cp855=IBM855
|
||||
855=IBM855
|
||||
csIBM855=IBM855
|
||||
##
|
||||
## Aliases for IBM857
|
||||
##
|
||||
cp857=IBM857
|
||||
857=IBM857
|
||||
csIBM857=IBM857
|
||||
##
|
||||
## Aliases for IBM862
|
||||
##
|
||||
cp862=IBM862
|
||||
862=IBM862
|
||||
csIBM862=IBM862
|
||||
##
|
||||
## Aliases for IBM864
|
||||
##
|
||||
cp864=IBM864
|
||||
864=IBM864
|
||||
csIBM864=IBM864
|
||||
ibm-864=IBM864
|
||||
##
|
||||
## Aliases for IBM864i
|
||||
##
|
||||
cp864i=IBM864i
|
||||
864i=IBM864i
|
||||
csibm864i=IBM864i
|
||||
ibm-864i=IBM864i
|
||||
##
|
||||
## Aliases for T.61-8bit
|
||||
##
|
||||
t.61=T.61-8bit
|
||||
iso-ir-103=T.61-8bit
|
||||
csiso103t618bit=T.61-8bit
|
||||
##
|
||||
## Aliases for UTF-7
|
||||
##
|
||||
x-unicode-2-0-utf-7=UTF-7
|
||||
unicode-2-0-utf-7=UTF-7
|
||||
unicode-1-1-utf-7=UTF-7
|
||||
csunicode11utf7=UTF-7
|
||||
##
|
||||
## Aliases for ISO-10646-UCS-2
|
||||
##
|
||||
csunicode=UTF-16BE
|
||||
csunicode11=UTF-16BE
|
||||
iso-10646-ucs-basic=UTF-16BE
|
||||
csunicodeascii=UTF-16BE
|
||||
iso-10646-unicode-latin1=UTF-16BE
|
||||
csunicodelatin1=UTF-16BE
|
||||
iso-10646=UTF-16BE
|
||||
iso-10646-j-1=UTF-16BE
|
||||
##
|
||||
## Aliases for ISO-8859-10
|
||||
##
|
||||
latin6=ISO-8859-10
|
||||
iso-ir-157=ISO-8859-10
|
||||
l6=ISO-8859-10
|
||||
# Currently .properties cannot handle : in key
|
||||
#iso_8859-10:1992=ISO-8859-10
|
||||
csisolatin6=ISO-8859-10
|
||||
##
|
||||
## Aliases for ISO-8859-15
|
||||
##
|
||||
iso_8859-15=ISO-8859-15
|
||||
##
|
||||
## Aliases for ISO-IR-111
|
||||
##
|
||||
ecma-cyrillic=ISO-IR-111
|
||||
csiso111ecmacyrillic=ISO-IR-111
|
||||
##
|
||||
## Aliases for ISO-2022-KR
|
||||
##
|
||||
csiso2022kr=ISO-2022-KR
|
||||
##
|
||||
## Aliases for VISCII
|
||||
##
|
||||
csviscii=VISCII
|
||||
##
|
||||
## Aliases for VIQR
|
||||
##
|
||||
csviqr=VIQR
|
||||
##
|
||||
## Aliases for x-euc-tw
|
||||
##
|
||||
zh_tw-euc=x-euc-tw
|
||||
##
|
||||
## Following names appears in unix nl_langinfo(CODESET)
|
||||
## They can be compiled as platform specific if necessary
|
||||
## DONT put things here if it does not look generic enough (like hp15CN)
|
||||
##
|
||||
iso88591=ISO-8859-1
|
||||
iso88592=ISO-8859-2
|
||||
iso88593=ISO-8859-3
|
||||
iso88594=ISO-8859-4
|
||||
iso88595=ISO-8859-5
|
||||
iso88596=ISO-8859-6
|
||||
iso88597=ISO-8859-7
|
||||
iso88598=ISO-8859-8
|
||||
iso88599=ISO-8859-9
|
||||
iso885910=ISO-8859-10
|
||||
iso885911=TIS-620
|
||||
iso885912=ISO-8859-12
|
||||
iso885913=ISO-8859-13
|
||||
iso885914=ISO-8859-14
|
||||
iso885915=ISO-8859-15
|
||||
##
|
||||
tis620=TIS-620
|
||||
##
|
||||
cp1250=windows-1250
|
||||
cp1251=windows-1251
|
||||
cp1252=windows-1252
|
||||
cp1253=windows-1253
|
||||
cp1254=windows-1254
|
||||
cp1255=windows-1255
|
||||
cp1256=windows-1256
|
||||
cp1257=windows-1257
|
||||
cp1258=windows-1258
|
||||
|
||||
## Tempory charset for testing purpose. Should be remove before Beta
|
||||
x-obsoleted-shift_jis=x-obsoleted-Shift_JIS
|
||||
x-obsoleted-iso-2022-jp=x-obsoleted-ISO-2022-JP
|
||||
x-obsoleted-euc-jp=x-obsoleted-EUC-JP
|
||||
x-gbk=x-gbk
|
||||
windows-936=windows-936
|
||||
ansi-1251=windows-1251
|
||||
@@ -1,182 +0,0 @@
|
||||
/* -*- 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 2
|
||||
srcBegin = 0081
|
||||
destBegin = 0081
|
||||
End of Item 0002
|
||||
|
||||
Begin of Item 0003
|
||||
Format 1
|
||||
srcBegin = 008D
|
||||
srcEnd = 0090
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
008D FFFD 008F 0090
|
||||
End of Item 0003
|
||||
|
||||
Begin of Item 0004
|
||||
Format 2
|
||||
srcBegin = 009D
|
||||
destBegin = 009D
|
||||
End of Item 0004
|
||||
|
||||
Begin of Item 0005
|
||||
Format 1
|
||||
srcBegin = 0152
|
||||
srcEnd = 0153
|
||||
mappingOffset = 0004
|
||||
Mapping =
|
||||
008C 009C
|
||||
End of Item 0005
|
||||
|
||||
Begin of Item 0006
|
||||
Format 1
|
||||
srcBegin = 0160
|
||||
srcEnd = 0161
|
||||
mappingOffset = 0006
|
||||
Mapping =
|
||||
008A 009A
|
||||
End of Item 0006
|
||||
|
||||
Begin of Item 0007
|
||||
Format 1
|
||||
srcBegin = 0178
|
||||
srcEnd = 017E
|
||||
mappingOffset = 0008
|
||||
Mapping =
|
||||
009F FFFD FFFD FFFD FFFD 008E 009E
|
||||
End of Item 0007
|
||||
|
||||
Begin of Item 0008
|
||||
Format 2
|
||||
srcBegin = 0192
|
||||
destBegin = 0083
|
||||
End of Item 0008
|
||||
|
||||
Begin of Item 0009
|
||||
Format 2
|
||||
srcBegin = 02C6
|
||||
destBegin = 0088
|
||||
End of Item 0009
|
||||
|
||||
Begin of Item 000A
|
||||
Format 2
|
||||
srcBegin = 02DC
|
||||
destBegin = 0098
|
||||
End of Item 000A
|
||||
|
||||
Begin of Item 000B
|
||||
Format 1
|
||||
srcBegin = 2013
|
||||
srcEnd = 203A
|
||||
mappingOffset = 000F
|
||||
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 000B
|
||||
|
||||
Begin of Item 000C
|
||||
Format 2
|
||||
srcBegin = 20AC
|
||||
destBegin = 0080
|
||||
End of Item 000C
|
||||
|
||||
Begin of Item 000D
|
||||
Format 2
|
||||
srcBegin = 2122
|
||||
destBegin = 0099
|
||||
End of Item 000D
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x000E,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0008,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x0032,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0002 */
|
||||
/* Total of Format 1 : 0x0005 */
|
||||
/* Total of Format 2 : 0x0007 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x1200, 0x1112, 0x1222, 0x0022,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0008 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x007F, 0x0000,
|
||||
/* 0001 */ 0x00A0, 0x00FF, 0x00A0,
|
||||
/* 0002 */ 0x0081, 0x0000, 0x0081,
|
||||
/* 0003 */ 0x008D, 0x0090, 0x0000,
|
||||
/* 0004 */ 0x009D, 0x0000, 0x009D,
|
||||
/* 0005 */ 0x0152, 0x0153, 0x0004,
|
||||
/* 0006 */ 0x0160, 0x0161, 0x0006,
|
||||
/* 0007 */ 0x0178, 0x017E, 0x0008,
|
||||
/* 0008 */ 0x0192, 0x0000, 0x0083,
|
||||
/* 0009 */ 0x02C6, 0x0000, 0x0088,
|
||||
/* 000A */ 0x02DC, 0x0000, 0x0098,
|
||||
/* 000B */ 0x2013, 0x203A, 0x000F,
|
||||
/* 000C */ 0x20AC, 0x0000, 0x0080,
|
||||
/* 000D */ 0x2122, 0x0000, 0x0099,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0032 Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x008D, 0xFFFD, 0x008F, 0x0090, 0x008C, 0x009C, 0x008A, 0x009A,
|
||||
/* 0008 */ 0x009F, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x008E, 0x009E, 0x0096,
|
||||
/* 0010 */ 0x0097, 0xFFFD, 0xFFFD, 0xFFFD, 0x0091, 0x0092, 0x0082, 0xFFFD,
|
||||
/* 0018 */ 0x0093, 0x0094, 0x0084, 0xFFFD, 0x0086, 0x0087, 0x0095, 0xFFFD,
|
||||
/* 0020 */ 0xFFFD, 0xFFFD, 0x0085, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0028 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x0089, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0030 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x008B, 0x009B,
|
||||
/* End of table Total Length = 0x0069 * 2 */
|
||||
@@ -1,105 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/*========================================================
|
||||
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 0081 201A 0192 201E 2026 2020 2021
|
||||
02C6 2030 0160 2039 0152 008D 017D 008F
|
||||
0090 2018 2019 201C 201D 2022 2013 2014
|
||||
02DC 2122 0161 203A 0153 009D 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, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
/* 0008 */ 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F,
|
||||
/* 0010 */ 0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
/* 0018 */ 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178,
|
||||
/* End of table Total Length = 0x002E * 2 */
|
||||
@@ -1,2 +0,0 @@
|
||||
en-US.jar:
|
||||
locale/en-US/global/charsetTitles.properties
|
||||
@@ -1,66 +0,0 @@
|
||||
##
|
||||
## 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) 1999 Netscape Communications Corporation. All
|
||||
## Rights Reserved.
|
||||
##
|
||||
## Contributor(s):
|
||||
##
|
||||
## Region code section, this is used to map a region code to a charset name
|
||||
## It have higher priority than the Script code section
|
||||
##
|
||||
region.68=x-mac-croatian
|
||||
region.25=x-mac-croatian
|
||||
region.20=x-mac-greek
|
||||
region.21=x-mac-icelandic
|
||||
region.39=x-mac-romanian
|
||||
region.24=x-mac-turkish
|
||||
region.62=x-mac-ukrainian
|
||||
##
|
||||
## Script code section, this is used to map a script code to a charset name
|
||||
## It have lower priority than the Region code section
|
||||
##
|
||||
script.0=x-mac-roman
|
||||
script.1=Shift_JIS
|
||||
script.2=Big5
|
||||
script.3=EUC-KR
|
||||
script.4=x-mac-arabic
|
||||
script.5=x-mac-hebrew
|
||||
script.6=x-mac-greek
|
||||
script.7=x-mac-cyrillic
|
||||
script.8=x-mac-rsymbol
|
||||
script.9=x-mac-devanagari
|
||||
script.10=x-mac-gurmukhi
|
||||
script.11=x-mac-gujarati
|
||||
script.12=x-mac-oriya
|
||||
script.13=x-mac-bengali
|
||||
script.14=x-mac-tamil
|
||||
script.15=x-mac-telugu
|
||||
script.16=x-mac-kannada
|
||||
script.17=x-mac-malayalam
|
||||
script.18=x-mac-sinhalese
|
||||
script.19=x-mac-burmese
|
||||
script.20=x-mac-khmer
|
||||
script.21=TIS-620
|
||||
script.22=x-mac-lao
|
||||
script.23=x-mac-georgian
|
||||
script.24=x-mac-armenian
|
||||
script.25=GB2312
|
||||
script.26=x-mac-tibetan
|
||||
script.27=x-mac-mongolian
|
||||
script.28=x-mac-ethiopic
|
||||
script.29=x-mac-ce
|
||||
script.30=x-mac-vietnamese
|
||||
script.31=x-mac-extarabic
|
||||
@@ -1,262 +0,0 @@
|
||||
/* -*- 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 */
|
||||
@@ -1,121 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/*========================================================
|
||||
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 */
|
||||
@@ -1,99 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# 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):
|
||||
|
||||
DEPTH=..\..\..
|
||||
MODULE=uconv
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
intl \
|
||||
locale \
|
||||
unicharutil \
|
||||
chardet \
|
||||
$(NULL)
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
DEFINES=-D_IMPL_NS_INTL -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
LIBRARY_NAME=uconv
|
||||
MODULE_NAME=nsUConvModule
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsTextToSubURI.obj \
|
||||
.\$(OBJDIR)\nsCharsetConverterManager.obj \
|
||||
.\$(OBJDIR)\nsUnicodeDecodeHelper.obj \
|
||||
.\$(OBJDIR)\nsUnicodeEncodeHelper.obj \
|
||||
.\$(OBJDIR)\nsWinCharset.obj \
|
||||
.\$(OBJDIR)\nsCharsetAliasImp.obj \
|
||||
.\$(OBJDIR)\nsUConvModule.obj \
|
||||
.\$(OBJDIR)\nsMappingCache.obj \
|
||||
.\$(OBJDIR)\nsURLProperties.obj \
|
||||
.\$(OBJDIR)\nsISO88591ToUnicode.obj \
|
||||
.\$(OBJDIR)\nsCP1252ToUnicode.obj \
|
||||
.\$(OBJDIR)\nsMacRomanToUnicode.obj \
|
||||
.\$(OBJDIR)\nsUTF8ToUnicode.obj \
|
||||
.\$(OBJDIR)\nsUnicodeToISO88591.obj \
|
||||
.\$(OBJDIR)\nsUnicodeToCP1252.obj \
|
||||
.\$(OBJDIR)\nsUnicodeToMacRoman.obj \
|
||||
.\$(OBJDIR)\nsUnicodeToUTF8.obj \
|
||||
.\$(OBJDIR)\nsUCvMinSupport.obj \
|
||||
.\$(OBJDIR)\nsScriptableUConv.obj \
|
||||
.\$(OBJDIR)\nsConverterInputStream.obj \
|
||||
$(NULL)
|
||||
|
||||
CSRCS = \
|
||||
umap.c \
|
||||
ugen.c \
|
||||
uscan.c \
|
||||
$(NULL)
|
||||
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\umap.obj \
|
||||
.\$(OBJDIR)\ugen.obj \
|
||||
.\$(OBJDIR)\uscan.obj \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS= \
|
||||
$(NULL)
|
||||
|
||||
|
||||
|
||||
LLIBS= \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\unicharutil_s.lib \
|
||||
$(LIBNSPR)
|
||||
|
||||
LCFLAGS = \
|
||||
$(LCFLAGS) \
|
||||
$(DEFINES) \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs::
|
||||
$(MAKE_INSTALL) .\charsetalias.properties $(DIST)\bin\res
|
||||
$(MAKE_INSTALL) .\wincharset.properties $(DIST)\bin\res
|
||||
$(MAKE_INSTALL) charsetData.properties $(DIST)\bin\res
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\bin\res\charsetalias.properties
|
||||
rm -f $(DIST)\bin\res\wincharset.properties
|
||||
rm -f $(DIST)\bin\res\charsetData.properties
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsCP1252ToUnicode.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static const PRUint16 g_utMappingTable[] = {
|
||||
#include "cp1252.ut"
|
||||
};
|
||||
|
||||
static const 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)
|
||||
{
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsCP1252ToUnicode_h___
|
||||
#define nsCP1252ToUnicode_h___
|
||||
|
||||
// Class ID for our CP1252ToUnicode charset converter
|
||||
// {7C657D15-EC5E-11d2-8AAC-00600811A836}
|
||||
#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___ */
|
||||
@@ -1,68 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsCharsetAlias_h__
|
||||
#define nsCharsetAlias_h__
|
||||
|
||||
#include "nsICharsetAlias.h"
|
||||
#include "nsURLProperties.h"
|
||||
|
||||
//==============================================================
|
||||
class nsCharsetAlias2 : public nsICharsetAlias
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
|
||||
nsCharsetAlias2();
|
||||
virtual ~nsCharsetAlias2();
|
||||
|
||||
NS_IMETHOD GetPreferred(const nsAString& aAlias, nsAString& oResult);
|
||||
NS_IMETHOD GetPreferred(const PRUnichar* aAlias, const PRUnichar** oResult) ;
|
||||
NS_IMETHOD GetPreferred(const char* aAlias, char* oResult, PRInt32 aBufLength) ;
|
||||
|
||||
NS_IMETHOD Equals(const nsAString& aCharset1, const nsAString& aCharset2, PRBool* oResult) ;
|
||||
NS_IMETHOD Equals(const PRUnichar* aCharset1, const PRUnichar* aCharset2, PRBool* oResult) ;
|
||||
NS_IMETHOD Equals(const char* aCharset1, const char* aCharset2, PRBool* oResult) ;
|
||||
|
||||
private:
|
||||
nsURLProperties* mDelegate;
|
||||
};
|
||||
|
||||
#endif // nsCharsetAlias_h__
|
||||
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
#include "nsICharsetAlias.h"
|
||||
#include "pratom.h"
|
||||
|
||||
// for NS_IMPL_IDS only
|
||||
#include "nsIPlatformCharset.h"
|
||||
|
||||
#include "nsUConvDll.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsURLProperties.h"
|
||||
#include "nsITimelineService.h"
|
||||
#include "nsCharsetAlias.h"
|
||||
|
||||
//--------------------------------------------------------------
|
||||
NS_IMPL_ISUPPORTS1(nsCharsetAlias2, nsICharsetAlias);
|
||||
|
||||
//--------------------------------------------------------------
|
||||
nsCharsetAlias2::nsCharsetAlias2()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mDelegate = nsnull; // delay the load of mDelegate untill we need it.
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
nsCharsetAlias2::~nsCharsetAlias2()
|
||||
{
|
||||
if(mDelegate)
|
||||
delete mDelegate;
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
NS_IMETHODIMP nsCharsetAlias2::GetPreferred(const nsAString& aAlias, nsAString& oResult)
|
||||
{
|
||||
if (aAlias.IsEmpty()) return NS_ERROR_NULL_POINTER;
|
||||
NS_TIMELINE_START_TIMER("nsCharsetAlias2:GetPreferred");
|
||||
|
||||
nsAutoString aKey(aAlias);
|
||||
ToLowerCase(aKey);
|
||||
oResult.Truncate();
|
||||
|
||||
//delay loading charsetalias.properties by resolving most freq. aliases
|
||||
if(!mDelegate) {
|
||||
if(aKey.Equals(NS_LITERAL_STRING("utf-8"))) {
|
||||
oResult = NS_LITERAL_STRING("UTF-8");
|
||||
NS_TIMELINE_STOP_TIMER("nsCharsetAlias2:GetPreferred");
|
||||
return NS_OK;
|
||||
}
|
||||
if(aKey.Equals(NS_LITERAL_STRING("iso-8859-1"))) {
|
||||
oResult = NS_LITERAL_STRING("ISO-8859-1");
|
||||
NS_TIMELINE_STOP_TIMER("nsCharsetAlias2:GetPreferred");
|
||||
return NS_OK;
|
||||
}
|
||||
if(aKey.Equals(NS_LITERAL_STRING("x-sjis")) ||
|
||||
aKey.Equals(NS_LITERAL_STRING("shift_jis"))) {
|
||||
oResult = NS_LITERAL_STRING("Shift_JIS");
|
||||
NS_TIMELINE_STOP_TIMER("nsCharsetAlias2:GetPreferred");
|
||||
return NS_OK;
|
||||
}
|
||||
//load charsetalias.properties string bundle with all remaining aliases
|
||||
// we may need to protect the following section with a lock so we won't call the
|
||||
// 'new nsURLProperties' from two different threads
|
||||
mDelegate = new nsURLProperties( NS_LITERAL_CSTRING("resource:/res/charsetalias.properties") );
|
||||
NS_ASSERTION(mDelegate, "cannot create nsURLProperties");
|
||||
if(nsnull == mDelegate)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_TIMELINE_STOP_TIMER("nsCharsetAlias2:GetPreferred");
|
||||
NS_TIMELINE_MARK_TIMER("nsCharsetAlias2:GetPreferred");
|
||||
|
||||
return mDelegate->Get(aKey, oResult);
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
NS_IMETHODIMP nsCharsetAlias2::GetPreferred(const PRUnichar* aAlias, const PRUnichar** oResult)
|
||||
{
|
||||
// this method should be obsoleted
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
NS_IMETHODIMP nsCharsetAlias2::GetPreferred(const char* aAlias, char* oResult, PRInt32 aBufLength)
|
||||
{
|
||||
// this method should be obsoleted
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
NS_IMETHODIMP nsCharsetAlias2::Equals(const nsAString& aCharset1, const nsAString& aCharset2, PRBool* oResult)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if(aCharset1.Equals(aCharset2, nsCaseInsensitiveStringComparator())) {
|
||||
*oResult = PR_TRUE;
|
||||
return res;
|
||||
}
|
||||
|
||||
if(aCharset1.IsEmpty() || aCharset2.IsEmpty()) {
|
||||
*oResult = PR_FALSE;
|
||||
return res;
|
||||
}
|
||||
|
||||
*oResult = PR_FALSE;
|
||||
nsString name1;
|
||||
nsString name2;
|
||||
res = this->GetPreferred(aCharset1, name1);
|
||||
if(NS_SUCCEEDED(res)) {
|
||||
res = this->GetPreferred(aCharset2, name2);
|
||||
if(NS_SUCCEEDED(res)) {
|
||||
*oResult = name1.Equals(name2, nsCaseInsensitiveStringComparator());
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
NS_IMETHODIMP nsCharsetAlias2::Equals(const PRUnichar* aCharset1, const PRUnichar* aCharset2, PRBool* oResult)
|
||||
{
|
||||
// this method should be obsoleted
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
NS_IMETHODIMP nsCharsetAlias2::Equals(const char* aCharset1, const char* aCharset2, PRBool* oResult)
|
||||
{
|
||||
// this method should be obsoleted
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,479 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsICharsetAlias.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsICharsetConverterManager2.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsILocaleService.h"
|
||||
#include "nsUConvDll.h"
|
||||
#include "prmem.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsICharsetDetector.h"
|
||||
|
||||
// just for CIDs
|
||||
#include "nsIUnicodeDecodeHelper.h"
|
||||
#include "nsIUnicodeEncodeHelper.h"
|
||||
#include "nsCharsetConverterManager.h"
|
||||
|
||||
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
static NS_DEFINE_CID(kLocaleServiceCID, NS_LOCALESERVICE_CID);
|
||||
static NS_DEFINE_CID(kSupportsArrayCID, NS_SUPPORTSARRAY_CID);
|
||||
|
||||
// Pattern of cached, commonly used, single byte decoder
|
||||
#define NS_1BYTE_CODER_PATTERN "ISO-8859"
|
||||
#define NS_1BYTE_CODER_PATTERN_LEN 8
|
||||
|
||||
// Class nsCharsetConverterManager [implementation]
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS2(nsCharsetConverterManager,
|
||||
nsICharsetConverterManager,
|
||||
nsICharsetConverterManager2);
|
||||
|
||||
nsCharsetConverterManager::nsCharsetConverterManager()
|
||||
:mDataBundle(NULL), mTitleBundle(NULL)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsCharsetConverterManager::~nsCharsetConverterManager()
|
||||
{
|
||||
NS_IF_RELEASE(mDataBundle);
|
||||
NS_IF_RELEASE(mTitleBundle);
|
||||
}
|
||||
|
||||
|
||||
nsresult nsCharsetConverterManager::RegisterConverterManagerData()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICategoryManager> catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
RegisterConverterCategory(catman, NS_TITLE_BUNDLE_CATEGORY,
|
||||
"chrome://global/locale/charsetTitles.properties");
|
||||
RegisterConverterCategory(catman, NS_DATA_BUNDLE_CATEGORY,
|
||||
"resource:/res/charsetData.properties");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCharsetConverterManager::RegisterConverterCategory(nsICategoryManager* catman,
|
||||
const char* aCategory,
|
||||
const char* aURL)
|
||||
{
|
||||
return catman->AddCategoryEntry(aCategory, aURL, "",
|
||||
PR_TRUE, PR_TRUE, nsnull);
|
||||
}
|
||||
|
||||
nsresult nsCharsetConverterManager::LoadExtensibleBundle(
|
||||
const char* aCategory,
|
||||
nsIStringBundle ** aResult)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> sbServ =
|
||||
do_GetService(kStringBundleServiceCID, &res);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = sbServ->CreateExtensibleBundle(aCategory, aResult);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsCharsetConverterManager::GetBundleValue(nsIStringBundle * aBundle,
|
||||
const nsIAtom * aName,
|
||||
const nsAFlatString& aProp,
|
||||
PRUnichar ** aResult)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
nsAutoString key;
|
||||
res = ((nsIAtom *) aName)->ToString(key);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
ToLowerCase(key); // we lowercase the main comparison key
|
||||
if (!aProp.IsEmpty()) key.Append(aProp.get()); // yes, this param may be NULL
|
||||
|
||||
res = aBundle->GetStringFromName(key.get(), aResult);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsCharsetConverterManager::GetBundleValue(nsIStringBundle * aBundle,
|
||||
const nsIAtom * aName,
|
||||
const nsAFlatString& aProp,
|
||||
nsIAtom ** aResult)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
PRUnichar * value;
|
||||
res = GetBundleValue(aBundle, aName, aProp, &value);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
*aResult = NS_NewAtom(value);
|
||||
PR_Free(value);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Interface nsICharsetConverterManager [implementation]
|
||||
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetUnicodeEncoder(
|
||||
const nsString * aDest,
|
||||
nsIUnicodeEncoder ** aResult)
|
||||
{
|
||||
*aResult= nsnull;
|
||||
nsresult res = NS_OK;
|
||||
|
||||
nsCAutoString contractid(
|
||||
NS_LITERAL_CSTRING(NS_UNICODEENCODER_CONTRACTID_BASE) +
|
||||
NS_LossyConvertUCS2toASCII(*aDest));
|
||||
|
||||
nsCOMPtr<nsIUnicodeEncoder> encoder;
|
||||
// Always create an instance since encoders hold state.
|
||||
encoder = do_CreateInstance(contractid.get(), &res);
|
||||
|
||||
if (NS_FAILED(res))
|
||||
res = NS_ERROR_UCONV_NOCONV;
|
||||
else
|
||||
{
|
||||
*aResult = encoder.get();
|
||||
NS_ADDREF(*aResult);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetUnicodeDecoder(
|
||||
const nsString * aSrc,
|
||||
nsIUnicodeDecoder ** aResult)
|
||||
{
|
||||
*aResult= nsnull;
|
||||
nsresult res = NS_OK;;
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(kUnicodeDecoderContractIDBase,
|
||||
NS_UNICODEDECODER_CONTRACTID_BASE);
|
||||
|
||||
nsCAutoString contractid(kUnicodeDecoderContractIDBase +
|
||||
NS_LossyConvertUCS2toASCII(*aSrc));
|
||||
|
||||
nsCOMPtr<nsIUnicodeDecoder> decoder;
|
||||
if (!strncmp(contractid.get()+kUnicodeDecoderContractIDBase.Length(),
|
||||
NS_1BYTE_CODER_PATTERN,
|
||||
NS_1BYTE_CODER_PATTERN_LEN))
|
||||
{
|
||||
// Single byte decoders dont hold state. Optimize by using a service.
|
||||
decoder = do_GetService(contractid.get(), &res);
|
||||
}
|
||||
else
|
||||
{
|
||||
decoder = do_CreateInstance(contractid.get(), &res);
|
||||
}
|
||||
if(NS_FAILED(res))
|
||||
res = NS_ERROR_UCONV_NOCONV;
|
||||
else
|
||||
{
|
||||
*aResult = decoder.get();
|
||||
NS_ADDREF(*aResult);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetCharsetLangGroup(
|
||||
nsString * aCharset,
|
||||
nsIAtom ** aResult)
|
||||
{
|
||||
if (aCharset == NULL) return NS_ERROR_NULL_POINTER;
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
*aResult = NULL;
|
||||
|
||||
nsCOMPtr<nsIAtom> atom;
|
||||
nsresult res = GetCharsetAtom(aCharset->get(), getter_AddRefs(atom));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = GetCharsetLangGroup(atom, aResult);
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetUnicodeDecoder(
|
||||
const nsIAtom * aCharset,
|
||||
nsIUnicodeDecoder ** aResult)
|
||||
{
|
||||
if (aCharset == NULL) return NS_ERROR_NULL_POINTER;
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
*aResult = NULL;
|
||||
|
||||
// XXX use nsImmutableString
|
||||
nsAutoString name;
|
||||
NS_CONST_CAST(nsIAtom*, aCharset)->ToString(name);
|
||||
return GetUnicodeDecoder(&name, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetUnicodeEncoder(
|
||||
const nsIAtom * aCharset,
|
||||
nsIUnicodeEncoder ** aResult)
|
||||
{
|
||||
if (aCharset == NULL) return NS_ERROR_NULL_POINTER;
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
*aResult = NULL;
|
||||
|
||||
// XXX use nsImmutableString
|
||||
nsAutoString name;
|
||||
NS_CONST_CAST(nsIAtom*, aCharset)->ToString(name);
|
||||
return GetUnicodeEncoder(&name, aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCharsetConverterManager::GetList(const nsACString& aCategory,
|
||||
const nsACString& aPrefix,
|
||||
nsISupportsArray** aResult)
|
||||
{
|
||||
if (aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aResult = NULL;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIAtom> atom;
|
||||
|
||||
nsCOMPtr<nsISupportsArray> array = do_CreateInstance(kSupportsArrayCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsICategoryManager> catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
catman->EnumerateCategory(PromiseFlatCString(aCategory).get(),
|
||||
getter_AddRefs(enumerator));
|
||||
|
||||
PRBool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
if (NS_FAILED(enumerator->GetNext(getter_AddRefs(supports))))
|
||||
continue;
|
||||
|
||||
nsCOMPtr<nsISupportsString> supStr = do_QueryInterface(supports);
|
||||
if (!supStr)
|
||||
continue;
|
||||
|
||||
nsCAutoString fullName(aPrefix);
|
||||
|
||||
nsXPIDLCString name;
|
||||
if (NS_FAILED(supStr->GetData(getter_Copies(name))))
|
||||
continue;
|
||||
|
||||
fullName += name;
|
||||
rv = GetCharsetAtom2(fullName.get(), getter_AddRefs(atom));
|
||||
if (NS_FAILED(rv))
|
||||
continue;
|
||||
|
||||
rv = array->AppendElement(atom);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aResult = array);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// we should change the interface so that we can just pass back a enumerator!
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetDecoderList(nsISupportsArray ** aResult)
|
||||
{
|
||||
return GetList(NS_LITERAL_CSTRING(NS_UNICODEDECODER_NAME),
|
||||
NS_LITERAL_CSTRING(""), aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetEncoderList(
|
||||
nsISupportsArray ** aResult)
|
||||
{
|
||||
return GetList(NS_LITERAL_CSTRING(NS_UNICODEENCODER_NAME),
|
||||
NS_LITERAL_CSTRING(""), aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetCharsetDetectorList(
|
||||
nsISupportsArray ** aResult)
|
||||
{
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
*aResult = NULL;
|
||||
|
||||
return GetList(NS_LITERAL_CSTRING(NS_CHARSET_DETECTOR_CATEGORY),
|
||||
NS_LITERAL_CSTRING("chardet."), aResult);
|
||||
}
|
||||
|
||||
// XXX Improve the implementation of this method. Right now, it is build on
|
||||
// top of two things: the nsCharsetAlias service and the Atom engine. We can
|
||||
// improve on both. First, make the nsCharsetAlias better, with its own hash
|
||||
// table (not the StringBundle anymore) and a nicer file format. Second,
|
||||
// reimplement the Atom engine for the specific Charset case - more optimal.
|
||||
// Finally, unify the two for even better performance.
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetCharsetAtom(
|
||||
const PRUnichar * aCharset,
|
||||
nsIAtom ** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aCharset && aResult, "null param");
|
||||
if (!aCharset)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// We try to obtain the preferred name for this charset from the charset
|
||||
// aliases. If we don't get it from there, we just use the original string
|
||||
nsDependentString charset(aCharset);
|
||||
nsCOMPtr<nsICharsetAlias> csAlias( do_GetService(kCharsetAliasCID) );
|
||||
NS_ASSERTION(csAlias, "failed to get the CharsetAlias service");
|
||||
if (csAlias) {
|
||||
nsAutoString pref;
|
||||
nsresult res = csAlias->GetPreferred(charset, pref);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
*aResult = NS_NewAtom(pref);
|
||||
return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
*aResult = NS_NewAtom(charset);
|
||||
return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetCharsetAtom2(
|
||||
const char * aCharset,
|
||||
nsIAtom ** aResult)
|
||||
{
|
||||
nsAutoString str;
|
||||
str.AssignWithConversion(aCharset);
|
||||
return GetCharsetAtom(str.get(), aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetCharsetTitle(
|
||||
const nsIAtom * aCharset,
|
||||
PRUnichar ** aResult)
|
||||
{
|
||||
if (aCharset == NULL) return NS_ERROR_NULL_POINTER;
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
*aResult = NULL;
|
||||
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (mTitleBundle == NULL) {
|
||||
res = LoadExtensibleBundle(NS_TITLE_BUNDLE_CATEGORY, &mTitleBundle);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
|
||||
res = GetBundleValue(mTitleBundle, aCharset, NS_LITERAL_STRING(".title"), aResult);
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetCharsetTitle2(
|
||||
const nsIAtom * aCharset,
|
||||
nsString * aResult)
|
||||
{
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult res = NS_OK;
|
||||
|
||||
PRUnichar * title;
|
||||
res = GetCharsetTitle(aCharset, &title);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
aResult->Assign(title);
|
||||
PR_Free(title);
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetCharsetData(
|
||||
const nsIAtom * aCharset,
|
||||
const PRUnichar * aProp,
|
||||
PRUnichar ** aResult)
|
||||
{
|
||||
if (aCharset == NULL) return NS_ERROR_NULL_POINTER;
|
||||
// aProp can be NULL
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
*aResult = NULL;
|
||||
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (mDataBundle == NULL) {
|
||||
res = LoadExtensibleBundle(NS_DATA_BUNDLE_CATEGORY, &mDataBundle);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
|
||||
res = GetBundleValue(mDataBundle, aCharset, nsDependentString(aProp), aResult);
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetCharsetData2(
|
||||
const nsIAtom * aCharset,
|
||||
const PRUnichar * aProp,
|
||||
nsString * aResult)
|
||||
{
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult res = NS_OK;
|
||||
|
||||
PRUnichar * data;
|
||||
res = GetCharsetData(aCharset, aProp, &data);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
aResult->Assign(data);
|
||||
PR_Free(data);
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCharsetConverterManager::GetCharsetLangGroup(
|
||||
const nsIAtom * aCharset,
|
||||
nsIAtom ** aResult)
|
||||
{
|
||||
if (aCharset == NULL) return NS_ERROR_NULL_POINTER;
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
*aResult = NULL;
|
||||
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (mDataBundle == NULL) {
|
||||
res = LoadExtensibleBundle(NS_DATA_BUNDLE_CATEGORY, &mDataBundle);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
|
||||
res = GetBundleValue(mDataBundle, aCharset, NS_LITERAL_STRING(".LangGroup"), aResult);
|
||||
return res;
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsCharsetConverterManager_h__
|
||||
#define nsCharsetConverterManager_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIRegistry.h"
|
||||
|
||||
class nsCharsetConverterManager : public nsICharsetConverterManager,
|
||||
public nsICharsetConverterManager2
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICHARSETCONVERTERMANAGER2
|
||||
|
||||
public:
|
||||
|
||||
nsCharsetConverterManager();
|
||||
virtual ~nsCharsetConverterManager();
|
||||
|
||||
NS_IMETHOD GetUnicodeEncoder(const nsString * aDest,
|
||||
nsIUnicodeEncoder ** aResult);
|
||||
NS_IMETHOD GetUnicodeDecoder(const nsString * aSrc,
|
||||
nsIUnicodeDecoder ** aResult);
|
||||
NS_IMETHOD GetCharsetLangGroup(nsString * aCharset, nsIAtom ** aResult);
|
||||
|
||||
private:
|
||||
|
||||
nsIStringBundle * mDataBundle;
|
||||
nsIStringBundle * mTitleBundle;
|
||||
|
||||
nsresult LoadExtensibleBundle(const char * aRegistryKey,
|
||||
nsIStringBundle ** aResult);
|
||||
|
||||
static nsresult RegisterConverterCategory(nsICategoryManager*,
|
||||
const char* aCategory,
|
||||
const char* aURL);
|
||||
|
||||
nsresult GetBundleValue(nsIStringBundle * aBundle, const nsIAtom * aName,
|
||||
const nsAFlatString& aProp, PRUnichar ** aResult);
|
||||
|
||||
nsresult GetBundleValue(nsIStringBundle * aBundle, const nsIAtom * aName,
|
||||
const nsAFlatString& aProp, nsIAtom ** aResult);
|
||||
|
||||
nsresult GetList(const nsACString& aCategory,
|
||||
const nsACString& aPrefix, nsISupportsArray** aResult);
|
||||
public:
|
||||
static nsresult RegisterConverterManagerData();
|
||||
|
||||
};
|
||||
|
||||
#endif // nsCharsetConverterManager_h__
|
||||
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsConverterInputStream.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#define CONVERTER_BUFFER_SIZE 8192
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsConverterInputStream, nsIConverterInputStream)
|
||||
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConverterInputStream::Init(nsIInputStream* aStream,
|
||||
const PRUnichar *aCharset,
|
||||
PRInt32 aBufferSize)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (aBufferSize <=0) aBufferSize=CONVERTER_BUFFER_SIZE;
|
||||
|
||||
// get the decoder
|
||||
nsCOMPtr<nsICharsetConverterManager> ccm =
|
||||
do_GetService(kCharsetConverterManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return nsnull;
|
||||
|
||||
nsAutoString charset;
|
||||
if (aCharset)
|
||||
charset.Assign(aCharset);
|
||||
else
|
||||
charset.Assign(NS_LITERAL_STRING("ISO-8859-1"));
|
||||
|
||||
rv = ccm->GetUnicodeDecoder(&charset, getter_AddRefs(mConverter));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// set up our buffers
|
||||
rv = NS_NewByteBuffer(getter_AddRefs(mByteData), nsnull, aBufferSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = NS_NewUnicharBuffer(getter_AddRefs(mUnicharData), nsnull, aBufferSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mInput = aStream;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConverterInputStream::Close()
|
||||
{
|
||||
mInput = nsnull;
|
||||
mConverter = nsnull;
|
||||
mByteData = nsnull;
|
||||
mUnicharData = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConverterInputStream::Read(PRUnichar* aBuf,
|
||||
PRUint32 aOffset,
|
||||
PRUint32 aCount,
|
||||
PRUint32 *aReadCount)
|
||||
{
|
||||
NS_ASSERTION(mUnicharDataLength >= mUnicharDataOffset, "unsigned madness");
|
||||
PRUint32 rv = mUnicharDataLength - mUnicharDataOffset;
|
||||
nsresult errorCode;
|
||||
if (0 == rv) {
|
||||
// Fill the unichar buffer
|
||||
rv = Fill(&errorCode);
|
||||
if (rv <= 0) {
|
||||
*aReadCount = 0;
|
||||
return errorCode;
|
||||
}
|
||||
}
|
||||
if (rv > aCount) {
|
||||
rv = aCount;
|
||||
}
|
||||
memcpy(aBuf + aOffset, mUnicharData->GetBuffer() + mUnicharDataOffset,
|
||||
rv * sizeof(PRUnichar));
|
||||
mUnicharDataOffset += rv;
|
||||
*aReadCount = rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsConverterInputStream::Fill(nsresult * aErrorCode)
|
||||
{
|
||||
if (nsnull == mInput) {
|
||||
// We already closed the stream!
|
||||
*aErrorCode = NS_BASE_STREAM_CLOSED;
|
||||
return -1;
|
||||
}
|
||||
|
||||
NS_ASSERTION(mByteData->GetLength() >= mByteDataOffset, "unsigned madness");
|
||||
PRUint32 remainder = mByteData->GetLength() - mByteDataOffset;
|
||||
mByteDataOffset = remainder;
|
||||
PRInt32 nb = mByteData->Fill(aErrorCode, mInput, remainder);
|
||||
if (nb <= 0) {
|
||||
// Because we assume a many to one conversion, the lingering data
|
||||
// in the byte buffer must be a partial conversion
|
||||
// fragment. Because we know that we have recieved no more new
|
||||
// data to add to it, we can't convert it. Therefore, we discard
|
||||
// it.
|
||||
return nb;
|
||||
}
|
||||
NS_ASSERTION(remainder + nb == mByteData->GetLength(), "bad nb");
|
||||
|
||||
// Now convert as much of the byte buffer to unicode as possible
|
||||
PRInt32 dstLen = mUnicharData->GetBufferSize();
|
||||
PRInt32 srcLen = remainder + nb;
|
||||
*aErrorCode = mConverter->Convert(mByteData->GetBuffer(), &srcLen,
|
||||
mUnicharData->GetBuffer(), &dstLen);
|
||||
mUnicharDataOffset = 0;
|
||||
mUnicharDataLength = dstLen;
|
||||
mByteDataOffset += srcLen;
|
||||
return dstLen;
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIConverterInputStream.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsIByteBuffer.h"
|
||||
#include "nsIUnicharBuffer.h"
|
||||
|
||||
#define NS_CONVERTERINPUTSTREAM_CONTRACTID "@mozilla.org/intl/converter-input-stream;1"
|
||||
|
||||
// {2BC2AD62-AD5D-4b7b-A9DB-F74AE203C527}
|
||||
#define NS_CONVERTERINPUTSTREAM_CID \
|
||||
{ 0x2bc2ad62, 0xad5d, 0x4b7b, \
|
||||
{ 0xa9, 0xdb, 0xf7, 0x4a, 0xe2, 0x3, 0xc5, 0x27 } }
|
||||
|
||||
|
||||
|
||||
class nsConverterInputStream : nsIConverterInputStream {
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD Read(PRUnichar* aBuf,
|
||||
PRUint32 aOffset,
|
||||
PRUint32 aCount,
|
||||
PRUint32 *aReadCount);
|
||||
NS_IMETHOD Close();
|
||||
NS_IMETHOD Init(nsIInputStream* aStream, const PRUnichar *aCharset,
|
||||
PRInt32 aBufferSize);
|
||||
|
||||
nsConverterInputStream() :
|
||||
mByteDataOffset(0),
|
||||
mUnicharDataOffset(0),
|
||||
mUnicharDataLength(0) { NS_INIT_REFCNT(); }
|
||||
|
||||
virtual ~nsConverterInputStream() {}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
PRInt32 Fill(nsresult *aErrorCode);
|
||||
|
||||
nsCOMPtr<nsIUnicodeDecoder> mConverter;
|
||||
nsCOMPtr<nsIByteBuffer> mByteData;
|
||||
nsCOMPtr<nsIUnicharBuffer> mUnicharData;
|
||||
nsCOMPtr<nsIInputStream> mInput;
|
||||
|
||||
PRUint32 mByteDataOffset;
|
||||
PRUint32 mUnicharDataOffset;
|
||||
PRUint32 mUnicharDataLength;
|
||||
|
||||
};
|
||||
@@ -1,62 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsISO88591ToUnicode.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static const PRUint16 g_utMappingTable[] = {
|
||||
#include "cp1252.ut"
|
||||
};
|
||||
|
||||
static const 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)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsISO88591ToUnicode_h___
|
||||
#define nsISO88591ToUnicode_h___
|
||||
|
||||
// Class ID for our ISO88591ToUnicode charset converter
|
||||
// {A3254CB0-8E20-11d2-8A98-00600811A836}
|
||||
#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___ */
|
||||
@@ -1,195 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <Script.h>
|
||||
#include <TextCommon.h>
|
||||
#include "nsIPlatformCharset.h"
|
||||
#include "pratom.h"
|
||||
#include "nsURLProperties.h"
|
||||
#include "nsUConvDll.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIMacLocale.h"
|
||||
#include "nsLocaleCID.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsPlatformCharset.h"
|
||||
|
||||
static nsURLProperties *gInfo = nsnull;
|
||||
static PRInt32 gCnt = 0;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsPlatformCharset, nsIPlatformCharset);
|
||||
|
||||
nsPlatformCharset::nsPlatformCharset()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&gCnt);
|
||||
}
|
||||
nsPlatformCharset::~nsPlatformCharset()
|
||||
{
|
||||
PR_AtomicDecrement(&gCnt);
|
||||
if((0 == gCnt) && (nsnull != gInfo)) {
|
||||
delete gInfo;
|
||||
gInfo = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult nsPlatformCharset::InitInfo()
|
||||
{
|
||||
// load the .property file if necessary
|
||||
if (gInfo == nsnull) {
|
||||
nsURLProperties *info = new nsURLProperties( NS_LITERAL_CSTRING("resource:/res/maccharset.properties") );
|
||||
NS_ASSERTION(info , "cannot open properties file");
|
||||
NS_ENSURE_TRUE(info, NS_ERROR_FAILURE);
|
||||
gInfo = info;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsPlatformCharset::MapToCharset(short script, short region, nsAString& outCharset)
|
||||
{
|
||||
switch (region) {
|
||||
case verUS:
|
||||
case verFrance:
|
||||
case verGermany:
|
||||
outCharset.Assign(NS_LITERAL_STRING("x-mac-roman"));
|
||||
return NS_OK;
|
||||
case verJapan:
|
||||
outCharset.Assign(NS_LITERAL_STRING("Shift_JIS"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ensure the .property file is loaded
|
||||
nsresult rv = InitInfo();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// try mapping from region then from script
|
||||
nsAutoString key(NS_LITERAL_STRING("region."));
|
||||
key.AppendInt(region, 10);
|
||||
|
||||
rv = gInfo->Get(key, outCharset);
|
||||
if (NS_FAILED(rv)) {
|
||||
key.Assign(NS_LITERAL_STRING("script."));
|
||||
key.AppendInt(script, 10);
|
||||
rv = gInfo->Get(key, outCharset);
|
||||
// not found in the .property file, assign x-mac-roman
|
||||
if (NS_FAILED(rv)) {
|
||||
outCharset.Assign(NS_LITERAL_STRING("x-mac-roman"));
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlatformCharset::GetCharset(nsPlatformCharsetSel selector, nsAString& oResult)
|
||||
{
|
||||
nsresult rv;
|
||||
if (mCharset.IsEmpty()) {
|
||||
rv = MapToCharset(
|
||||
(short)(0x0000FFFF & ::GetScriptManagerVariable(smSysScript)),
|
||||
(short)(0x0000FFFF & ::GetScriptManagerVariable(smRegionCode)),
|
||||
mCharset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
switch (selector) {
|
||||
case kPlatformCharsetSel_KeyboardInput:
|
||||
rv = MapToCharset(
|
||||
(short) (0x0000FFFF & ::GetScriptManagerVariable(smKeyScript)),
|
||||
kTextRegionDontCare, oResult);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
break;
|
||||
default:
|
||||
oResult = mCharset;
|
||||
break;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlatformCharset::GetDefaultCharsetForLocale(const PRUnichar* localeName, PRUnichar** _retValue)
|
||||
{
|
||||
nsCOMPtr<nsIMacLocale> pMacLocale;
|
||||
nsAutoString localeAsString(localeName), charset(NS_LITERAL_STRING("x-mac-roman"));
|
||||
short script, language, region;
|
||||
|
||||
nsresult rv;
|
||||
pMacLocale = do_CreateInstance(NS_MACLOCALE_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = pMacLocale->GetPlatformLocale(&localeAsString, &script, &language, ®ion);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = MapToCharset(script, region, charset);
|
||||
}
|
||||
}
|
||||
*_retValue = ToNewUnicode(charset);
|
||||
NS_ENSURE_TRUE(*_retValue, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlatformCharset::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::MapToCharset(nsAString& inANSICodePage, nsAString& outCharset)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::InitGetCharset(nsAString &oString)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::ConvertLocaleToCharsetUsingDeprecatedConfig(nsAutoString& locale, nsAString& oResult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::VerifyCharset(nsString &aCharset)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsMacRomanToUnicode.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static const PRUint16 g_MacRomanMappingTable[] = {
|
||||
#include "macroman.ut"
|
||||
};
|
||||
|
||||
static const 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, 1)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsMacRomanToUnicode_h___
|
||||
#define nsMacRomanToUnicode_h___
|
||||
|
||||
// Class ID for our MacRomanToUnicode charset converter
|
||||
// {7B8556A1-EC79-11d2-8AAC-00600811A836}
|
||||
#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:
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsMacRomanToUnicode_h___ */
|
||||
@@ -1,81 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsMappingCache.h"
|
||||
|
||||
typedef struct {
|
||||
PRInt16 mask;
|
||||
PRInt16 reserved;
|
||||
PRUint32 data[1] ;
|
||||
} nsMappingCacheBase;
|
||||
|
||||
typedef struct {
|
||||
PRInt16 mask;
|
||||
PRInt16 reserved;
|
||||
PRUint32 data[64] ;
|
||||
} nsMappingCache64;
|
||||
|
||||
typedef struct {
|
||||
PRInt16 mask;
|
||||
PRInt16 reserved;
|
||||
PRUint32 data[128] ;
|
||||
} nsMappingCache128;
|
||||
|
||||
typedef struct {
|
||||
PRInt16 mask;
|
||||
PRInt16 reserved;
|
||||
PRUint32 data[256] ;
|
||||
} nsMappingCache256;
|
||||
|
||||
typedef struct {
|
||||
PRInt16 mask;
|
||||
PRInt16 reserved;
|
||||
PRUint32 data[512] ;
|
||||
} nsMappingCache512;
|
||||
|
||||
nsresult nsMappingCache::CreateCache(nsMappingCacheType aType, nsIMappingCache* aResult)
|
||||
{
|
||||
// to be implemented
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMappingCache::DestroyCache(nsIMappingCache aCache)
|
||||
{
|
||||
// to be implemented
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsMappingCache_h__
|
||||
#define nsMappingCache_h__
|
||||
|
||||
|
||||
#include "nsIMappingCache.h"
|
||||
#include "nsError.h"
|
||||
|
||||
|
||||
class nsMappingCache {
|
||||
public:
|
||||
/**
|
||||
* Create a Mapping Cache
|
||||
*/
|
||||
static nsresult CreateCache(nsMappingCacheType aType, nsIMappingCache* aResult);
|
||||
|
||||
/**
|
||||
* Destroy a Mapping Cache
|
||||
*/
|
||||
static nsresult DestroyCache(nsIMappingCache aCache);
|
||||
};
|
||||
#endif /* nsMappingCache_h__ */
|
||||
@@ -1,148 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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):
|
||||
* John Fairhurst
|
||||
* Henry Sobotka
|
||||
* IBM Corp.
|
||||
*/
|
||||
#include "nsIPlatformCharset.h"
|
||||
#include "nsURLProperties.h"
|
||||
#include "pratom.h"
|
||||
#define INCL_PM
|
||||
#include <os2.h>
|
||||
#include "nsUConvDll.h"
|
||||
#include "nsIOS2Locale.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsLocaleCID.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsPlatformCharset.h"
|
||||
|
||||
static nsURLProperties *gInfo = nsnull;
|
||||
static PRInt32 gCnt= 0;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsPlatformCharset, nsIPlatformCharset);
|
||||
|
||||
nsPlatformCharset::nsPlatformCharset()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&gCnt); // count for gInfo
|
||||
|
||||
// XXX We should make the following block critical section
|
||||
if(nsnull == gInfo)
|
||||
{
|
||||
nsURLProperties *info = new nsURLProperties(NS_LITERAL_CSTRING("resource:/res/os2charset.properties"));
|
||||
NS_ASSERTION( info , " cannot create nsURLProperties");
|
||||
gInfo = info;
|
||||
}
|
||||
NS_ASSERTION(gInfo, "Cannot open property file");
|
||||
if( gInfo )
|
||||
{
|
||||
UINT acp = ::WinQueryCp(HMQ_CURRENT);
|
||||
PRInt32 acpint = (PRInt32)(acp & 0x00FFFF);
|
||||
nsAutoString acpKey(NS_LITERAL_STRING("os2."));
|
||||
acpKey.AppendInt(acpint, 10);
|
||||
|
||||
nsresult res = gInfo->Get(acpKey, mCharset);
|
||||
if(NS_FAILED(res)) {
|
||||
mCharset.Assign(NS_LITERAL_STRING("IBM850"));
|
||||
}
|
||||
|
||||
} else {
|
||||
mCharset.Assign(NS_LITERAL_STRING("IBM850"));
|
||||
}
|
||||
}
|
||||
|
||||
nsPlatformCharset::~nsPlatformCharset()
|
||||
{
|
||||
PR_AtomicDecrement(&gCnt);
|
||||
if(0 == gCnt) {
|
||||
delete gInfo;
|
||||
gInfo = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlatformCharset::GetCharset(nsPlatformCharsetSel selector, nsAString& oResult)
|
||||
{
|
||||
if ((selector == kPlatformCharsetSel_4xBookmarkFile) || (selector == kPlatformCharsetSel_4xPrefsJS)) {
|
||||
if ((mCharset.Find("IBM850", IGNORE_CASE) != -1) || (mCharset.Find("IBM437", IGNORE_CASE) != -1))
|
||||
oResult.Assign(NS_LITERAL_STRING("ISO-8859-1"));
|
||||
else if (mCharset.Find("IBM852", IGNORE_CASE) != -1)
|
||||
oResult.Assign(NS_LITERAL_STRING("windows-1250"));
|
||||
else if ((mCharset.Find("IBM855", IGNORE_CASE) != -1) || (mCharset.Find("IBM866", IGNORE_CASE) != -1))
|
||||
oResult.Assign(NS_LITERAL_STRING("windows-1251"));
|
||||
else if ((mCharset.Find("IBM869", IGNORE_CASE) != -1) || (mCharset.Find("IBM813", IGNORE_CASE) != -1))
|
||||
oResult.Assign(NS_LITERAL_STRING("windows-1253"));
|
||||
else if (mCharset.Find("IBM857", IGNORE_CASE) != -1)
|
||||
oResult.Assign(NS_LITERAL_STRING("windows-1254"));
|
||||
else
|
||||
oResult = mCharset;
|
||||
} else {
|
||||
oResult = mCharset;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlatformCharset::GetDefaultCharsetForLocale(const PRUnichar* localeName, PRUnichar** _retValue)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlatformCharset::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult
|
||||
nsPlatformCharset::MapToCharset(short script, short region, nsAString& outCharset)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::MapToCharset(nsAString& inANSICodePage, nsAString& outCharset)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::InitGetCharset(nsAString &oString)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::ConvertLocaleToCharsetUsingDeprecatedConfig(nsAutoString& locale, nsAString& oResult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::VerifyCharset(nsString &aCharset)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::InitInfo()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsPlatformCharset_h__
|
||||
#define nsPlatformCharset_h__
|
||||
|
||||
#include "nsIPlatformCharset.h"
|
||||
|
||||
class nsPlatformCharset : public nsIPlatformCharset
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
|
||||
nsPlatformCharset();
|
||||
virtual ~nsPlatformCharset();
|
||||
|
||||
NS_IMETHOD Init();
|
||||
NS_IMETHOD GetCharset(nsPlatformCharsetSel selector, nsAString& oResult);
|
||||
NS_IMETHOD GetDefaultCharsetForLocale(const PRUnichar* localeName, PRUnichar** _retValue);
|
||||
|
||||
private:
|
||||
nsString mCharset;
|
||||
nsString mLocale; // remember the locale & charset
|
||||
|
||||
nsresult InitInfo();
|
||||
nsresult MapToCharset(short script, short region, nsAString& outCharset);
|
||||
nsresult MapToCharset(nsAString& inANSICodePage, nsAString& outCharset);
|
||||
nsresult InitGetCharset(nsAString& oString);
|
||||
nsresult ConvertLocaleToCharsetUsingDeprecatedConfig(nsAutoString& locale, nsAString& oResult);
|
||||
nsresult VerifyCharset(nsString &aCharset);
|
||||
};
|
||||
|
||||
#endif // nsPlatformCharset_h__
|
||||
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Makoto Kato <m_kato@ga2.so-net.ne.jp >
|
||||
* Ryoichi Furukawa <oliver@1000cp.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "pratom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsICharsetConverterManager2.h"
|
||||
#include "nsIScriptableUConv.h"
|
||||
#include "nsScriptableUConv.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "nsIPlatformCharset.h"
|
||||
|
||||
static NS_DEFINE_CID(kIScriptableUnicodeConverterCID, NS_ISCRIPTABLEUNICODECONVERTER_CID);
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
|
||||
static PRInt32 gInstanceCount = 0;
|
||||
|
||||
/* Implementation file */
|
||||
NS_IMPL_ISUPPORTS1(nsScriptableUnicodeConverter, nsIScriptableUnicodeConverter)
|
||||
|
||||
nsScriptableUnicodeConverter::nsScriptableUnicodeConverter()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&gInstanceCount);
|
||||
}
|
||||
|
||||
nsScriptableUnicodeConverter::~nsScriptableUnicodeConverter()
|
||||
{
|
||||
PR_AtomicDecrement(&gInstanceCount);
|
||||
}
|
||||
|
||||
/* string ConvertFromUnicode ([const] in wstring src); */
|
||||
NS_IMETHODIMP
|
||||
nsScriptableUnicodeConverter::ConvertFromUnicode(const PRUnichar *aSrc, char **_retval)
|
||||
{
|
||||
if (!mEncoder)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
PRInt32 inLength = nsCRT::strlen(aSrc);
|
||||
PRInt32 outLength;
|
||||
rv = mEncoder->GetMaxLength(aSrc, inLength, &outLength);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*_retval = (char*) nsMemory::Alloc(outLength+1);
|
||||
if (!*_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = mEncoder->Convert(aSrc, &inLength, *_retval, &outLength);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
(*_retval)[outLength] = '\0';
|
||||
return NS_OK;
|
||||
}
|
||||
nsMemory::Free(*_retval);
|
||||
}
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* wstring ConvertToUnicode ([const] in string src); */
|
||||
NS_IMETHODIMP
|
||||
nsScriptableUnicodeConverter::ConvertToUnicode(const char *aSrc, PRUnichar **_retval)
|
||||
{
|
||||
if (!mDecoder)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
PRInt32 inLength = strlen(aSrc);
|
||||
PRInt32 outLength;
|
||||
rv = mDecoder->GetMaxLength(aSrc, inLength, &outLength);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
*_retval = (PRUnichar*) nsMemory::Alloc((outLength+1)*sizeof(PRUnichar));
|
||||
if (!*_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = mDecoder->Convert(aSrc, &inLength, *_retval, &outLength);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
(*_retval)[outLength] = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
nsMemory::Free(*_retval);
|
||||
}
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* attribute wstring charset; */
|
||||
NS_IMETHODIMP
|
||||
nsScriptableUnicodeConverter::GetCharset(PRUnichar * *aCharset)
|
||||
{
|
||||
*aCharset = ToNewUnicode(mCharset);
|
||||
if (!*aCharset)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptableUnicodeConverter::SetCharset(const PRUnichar * aCharset)
|
||||
{
|
||||
mCharset.Assign(aCharset);
|
||||
return InitConverter();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsScriptableUnicodeConverter::InitConverter()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
mEncoder = NULL ;
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager2> ccm2 = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
|
||||
|
||||
if (NS_SUCCEEDED( rv) && (nsnull != ccm2)) {
|
||||
// get charset atom due to getting unicode converter
|
||||
nsCOMPtr <nsIAtom> charsetAtom;
|
||||
rv = ccm2->GetCharsetAtom(mCharset.get(), getter_AddRefs(charsetAtom));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get an unicode converter
|
||||
rv = ccm2->GetUnicodeEncoder(charsetAtom, getter_AddRefs(mEncoder));
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
rv = mEncoder->SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Replace, nsnull, (PRUnichar)'?');
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
rv = ccm2->GetUnicodeDecoder(charsetAtom, getter_AddRefs(mDecoder));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv ;
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Makoto Kato <m_kato@ga2.so-net.ne.jp >
|
||||
* Ryoichi Furukawa <oliver@1000cp.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
#ifndef __nsScriptableUConv_h_
|
||||
#define __nsScriptableUConv_h_
|
||||
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIScriptableUConv.h"
|
||||
|
||||
class nsScriptableUnicodeConverter : public nsIScriptableUnicodeConverter
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISCRIPTABLEUNICODECONVERTER
|
||||
|
||||
nsScriptableUnicodeConverter();
|
||||
virtual ~nsScriptableUnicodeConverter();
|
||||
|
||||
protected:
|
||||
nsAutoString mCharset;
|
||||
nsCOMPtr<nsIUnicodeEncoder> mEncoder;
|
||||
nsCOMPtr<nsIUnicodeDecoder> mDecoder;
|
||||
|
||||
nsresult InitConverter();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,160 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsString.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsITextToSubURI.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsUConvDll.h"
|
||||
#include "nsEscape.h"
|
||||
#include "prmem.h"
|
||||
#include "nsTextToSubURI.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
static NS_DEFINE_CID(kITextToSubURIIID, NS_ITEXTTOSUBURI_IID);
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
|
||||
nsTextToSubURI::nsTextToSubURI()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
nsTextToSubURI::~nsTextToSubURI()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsTextToSubURI, nsITextToSubURI)
|
||||
|
||||
NS_IMETHODIMP nsTextToSubURI::ConvertAndEscape(
|
||||
const char *charset, const PRUnichar *text, char **_retval)
|
||||
{
|
||||
if(nsnull == _retval)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*_retval = nsnull;
|
||||
nsAutoString charsetStr; charsetStr.AssignWithConversion(charset);
|
||||
nsIUnicodeEncoder *encoder = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Get Charset, get the encoder.
|
||||
nsICharsetConverterManager * ccm = nsnull;
|
||||
rv = nsServiceManager::GetService(kCharsetConverterManagerCID ,
|
||||
NS_GET_IID(nsICharsetConverterManager),
|
||||
(nsISupports**)&ccm);
|
||||
if(NS_SUCCEEDED(rv) && (nsnull != ccm)) {
|
||||
rv = ccm->GetUnicodeEncoder(&charsetStr, &encoder);
|
||||
nsServiceManager::ReleaseService( kCharsetConverterManagerCID, ccm);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = encoder->SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Replace, nsnull, (PRUnichar)'?');
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
char buf[256];
|
||||
char *pBuf = buf;
|
||||
PRInt32 ulen = nsCRT::strlen(text);
|
||||
PRInt32 outlen = 0;
|
||||
if(NS_SUCCEEDED(rv = encoder->GetMaxLength(text, ulen, &outlen)))
|
||||
{
|
||||
if(outlen >= 256) {
|
||||
pBuf = (char*)PR_Malloc(outlen+1);
|
||||
}
|
||||
if(nsnull == pBuf) {
|
||||
outlen = 255;
|
||||
pBuf = buf;
|
||||
}
|
||||
if(NS_SUCCEEDED(rv = encoder->Convert(text,&ulen, pBuf, &outlen))) {
|
||||
pBuf[outlen] = '\0';
|
||||
*_retval = nsEscape(pBuf, url_XPAlphas);
|
||||
if(nsnull == *_retval)
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
if(pBuf != buf)
|
||||
PR_Free(pBuf);
|
||||
}
|
||||
NS_IF_RELEASE(encoder);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsTextToSubURI::UnEscapeAndConvert(
|
||||
const char *charset, const char *text, PRUnichar **_retval)
|
||||
{
|
||||
if(nsnull == _retval)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*_retval = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// unescape the string, unescape changes the input
|
||||
char *unescaped = nsCRT::strdup((char *) text);
|
||||
if (nsnull == unescaped)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
unescaped = nsUnescape(unescaped);
|
||||
NS_ASSERTION(unescaped, "nsUnescape returned null");
|
||||
|
||||
// Convert from the charset to unicode
|
||||
nsCOMPtr<nsICharsetConverterManager> ccm =
|
||||
do_GetService(kCharsetConverterManagerCID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString charsetStr; charsetStr.AssignWithConversion(charset);
|
||||
nsIUnicodeDecoder *decoder;
|
||||
rv = ccm->GetUnicodeDecoder(&charsetStr, &decoder);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUnichar *pBuf = nsnull;
|
||||
PRInt32 len = strlen(unescaped);
|
||||
PRInt32 outlen = 0;
|
||||
if (NS_SUCCEEDED(rv = decoder->GetMaxLength(unescaped, len, &outlen))) {
|
||||
pBuf = (PRUnichar *) PR_Malloc((outlen+1)*sizeof(PRUnichar*));
|
||||
if (nsnull == pBuf)
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
else {
|
||||
if (NS_SUCCEEDED(rv = decoder->Convert(unescaped, &len, pBuf, &outlen))) {
|
||||
pBuf[outlen] = 0;
|
||||
*_retval = pBuf;
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(decoder);
|
||||
}
|
||||
}
|
||||
PR_FREEIF(unescaped);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@@ -1,54 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsTextToSubURI_h__
|
||||
#define nsTextToSubURI_h__
|
||||
|
||||
#include "nsITextToSubURI.h"
|
||||
|
||||
//==============================================================
|
||||
class nsTextToSubURI: public nsITextToSubURI {
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSITEXTTOSUBURI
|
||||
|
||||
public:
|
||||
nsTextToSubURI();
|
||||
virtual ~nsTextToSubURI();
|
||||
};
|
||||
|
||||
#endif // nsTextToSubURI_h__
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIUnicodeDecodeHelper.h"
|
||||
#include "nsUnicodeDecodeHelper.h"
|
||||
#include "nsIUnicodeEncodeHelper.h"
|
||||
#include "nsUnicodeEncodeHelper.h"
|
||||
#include "nsIPlatformCharset.h"
|
||||
#include "nsPlatformCharsetFactory.h"
|
||||
#include "nsICharsetAlias.h"
|
||||
#include "nsCharsetAliasFactory.h"
|
||||
#include "nsITextToSubURI.h"
|
||||
#include "nsTextToSubURI.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "rdf.h"
|
||||
#include "nsUConvDll.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
static NS_DEFINE_CID(kTextToSubURICID, NS_TEXTTOSUBURI_CID);
|
||||
@@ -1,47 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsUConvDll_h___
|
||||
#define nsUConvDll_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
class nsIComponentManager;
|
||||
class nsIFile;
|
||||
struct nsModuleComponentInfo;
|
||||
|
||||
#endif /* nsUConvDll_h___ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,44 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsUCvMinDll_h___
|
||||
#define nsUCvMinDll_h___
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
#endif /* nsUCvMinDll_h___ */
|
||||
@@ -1,410 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <locale.h>
|
||||
#include "nsIPlatformCharset.h"
|
||||
#include "pratom.h"
|
||||
#include "nsURLProperties.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsLocaleCID.h"
|
||||
#include "nsUConvDll.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsICharsetConverterManager2.h"
|
||||
#if HAVE_GNU_LIBC_VERSION_H
|
||||
#include <gnu/libc-version.h>
|
||||
#endif
|
||||
#ifdef HAVE_NL_TYPES_H
|
||||
#include <nl_types.h>
|
||||
#endif
|
||||
#if HAVE_NL_LANGINFO
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
#include "nsPlatformCharset.h"
|
||||
#include "nsAutoLock.h"
|
||||
#include "prinit.h"
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsPlatformCharset, nsIPlatformCharset);
|
||||
|
||||
static nsURLProperties *gNLInfo = nsnull;
|
||||
static nsURLProperties *gInfo_deprecated = nsnull;
|
||||
static PRInt32 gCnt=0;
|
||||
|
||||
//this lock is for protecting above static variable operation
|
||||
static PRLock *gLock = nsnull;
|
||||
|
||||
static PRStatus InitLock(void)
|
||||
{
|
||||
gLock = PR_NewLock();
|
||||
if (gLock)
|
||||
return PR_SUCCESS;
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
nsPlatformCharset::nsPlatformCharset()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&gCnt);
|
||||
static PRCallOnceType once;
|
||||
PR_CallOnce(&once, InitLock);
|
||||
NS_ASSERTION(gLock, "Can't allocate a lock?!");
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::ConvertLocaleToCharsetUsingDeprecatedConfig(nsAutoString& locale, nsAString& oResult)
|
||||
{
|
||||
|
||||
// locked for thread safety
|
||||
{
|
||||
nsAutoLock guard(gLock);
|
||||
if (!gInfo_deprecated) {
|
||||
nsURLProperties *info = new nsURLProperties(NS_LITERAL_CSTRING("resource:/res/unixcharset.properties"));
|
||||
NS_ASSERTION( info, "cannot create nsURLProperties");
|
||||
gInfo_deprecated = info;
|
||||
}
|
||||
}
|
||||
|
||||
if (gInfo_deprecated && !(locale.IsEmpty())) {
|
||||
nsAutoString platformLocaleKey;
|
||||
// note: NS_LITERAL_STRING("locale." OSTYPE ".") does not compile on AIX
|
||||
platformLocaleKey.Assign(NS_LITERAL_STRING("locale."));
|
||||
platformLocaleKey.AppendWithConversion(OSTYPE);
|
||||
platformLocaleKey.Append(NS_LITERAL_STRING("."));
|
||||
platformLocaleKey.Append(locale.get());
|
||||
|
||||
nsresult res = gInfo_deprecated->Get(platformLocaleKey, oResult);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsAutoString localeKey;
|
||||
localeKey.Assign(NS_LITERAL_STRING("locale.all."));
|
||||
localeKey.Append(locale.get());
|
||||
res = gInfo_deprecated->Get(localeKey, oResult);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(0, "unable to convert locale to charset using deprecated config");
|
||||
mCharset.Assign(NS_LITERAL_STRING("ISO-8859-1"));
|
||||
return NS_SUCCESS_USING_FALLBACK_LOCALE;
|
||||
}
|
||||
|
||||
nsPlatformCharset::~nsPlatformCharset()
|
||||
{
|
||||
PR_AtomicDecrement(&gCnt);
|
||||
if (!gCnt) {
|
||||
if (gNLInfo) {
|
||||
delete gNLInfo;
|
||||
gNLInfo = nsnull;
|
||||
PR_DestroyLock(gLock);
|
||||
gLock = nsnull;
|
||||
}
|
||||
if (gInfo_deprecated) {
|
||||
delete gInfo_deprecated;
|
||||
gInfo_deprecated = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlatformCharset::GetCharset(nsPlatformCharsetSel selector, nsAString& oResult)
|
||||
{
|
||||
oResult = mCharset;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlatformCharset::GetDefaultCharsetForLocale(const PRUnichar* localeName, PRUnichar** _retValue)
|
||||
{
|
||||
nsAutoString localeNameAsString(localeName);
|
||||
|
||||
//
|
||||
// if this locale is the user's locale then use the charset
|
||||
// we already determined at initialization
|
||||
//
|
||||
if (mLocale.Equals(localeNameAsString) ||
|
||||
// support the 4.x behavior
|
||||
(mLocale.EqualsIgnoreCase("en_US") && localeNameAsString.EqualsIgnoreCase("C"))) {
|
||||
*_retValue = ToNewUnicode(mCharset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if HAVE_NL_LANGINFO
|
||||
//
|
||||
// This locale appears to be a different locale from the user's locale.
|
||||
// To do this we would need to lock the global resource we are currently
|
||||
// using or use a library that provides multi locale support.
|
||||
// ICU is a possible example of a multi locale library.
|
||||
// http://oss.software.ibm.com/icu/
|
||||
//
|
||||
NS_ASSERTION(0, "GetDefaultCharsetForLocale: need to add multi locale support");
|
||||
// until we add multi locale support: use the the charset of the user's locale
|
||||
*_retValue = ToNewUnicode(mCharset);
|
||||
return NS_SUCCESS_USING_FALLBACK_LOCALE;
|
||||
#endif
|
||||
|
||||
//
|
||||
// convert from locale to charset
|
||||
// using the deprecated locale to charset mapping
|
||||
//
|
||||
nsAutoString localeStr(localeName);
|
||||
nsString charset;
|
||||
nsresult res = ConvertLocaleToCharsetUsingDeprecatedConfig(localeStr, charset);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
*_retValue = ToNewUnicode(charset);
|
||||
return res; // succeeded
|
||||
}
|
||||
|
||||
NS_ASSERTION(0, "unable to convert locale to charset using deprecated config");
|
||||
charset.Assign(NS_LITERAL_STRING("ISO-8859-1"));
|
||||
*_retValue = ToNewUnicode(charset);
|
||||
return NS_SUCCESS_USING_FALLBACK_LOCALE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::InitGetCharset(nsAString &oString)
|
||||
{
|
||||
char* nl_langinfo_codeset = nsnull;
|
||||
nsString aCharset;
|
||||
nsresult res;
|
||||
|
||||
#if HAVE_NL_LANGINFO && defined(CODESET)
|
||||
nl_langinfo_codeset = nl_langinfo(CODESET);
|
||||
NS_ASSERTION(nl_langinfo_codeset, "cannot get nl_langinfo(CODESET)");
|
||||
|
||||
//
|
||||
// see if we can use nl_langinfo(CODESET) directly
|
||||
//
|
||||
if (nl_langinfo_codeset) {
|
||||
aCharset.AssignWithConversion(nl_langinfo_codeset);
|
||||
res = VerifyCharset(aCharset);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
oString = aCharset;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
// locked for thread safety
|
||||
{
|
||||
nsAutoLock guard(gLock);
|
||||
|
||||
if (!gNLInfo) {
|
||||
nsCAutoString propertyURL;
|
||||
// note: NS_LITERAL_STRING("resource:/res/unixcharset." OSARCH ".properties") does not compile on AIX
|
||||
propertyURL.Assign(NS_LITERAL_CSTRING("resource:/res/unixcharset."));
|
||||
propertyURL.Append(OSARCH);
|
||||
propertyURL.Append(NS_LITERAL_CSTRING(".properties"));
|
||||
nsURLProperties *info;
|
||||
info = new nsURLProperties( propertyURL );
|
||||
NS_ASSERTION( info, "cannot create nsURLProperties");
|
||||
if (info) {
|
||||
PRBool didLoad;
|
||||
info->DidLoad(didLoad);
|
||||
if (!didLoad) {
|
||||
delete info;
|
||||
info = nsnull;
|
||||
}
|
||||
}
|
||||
gNLInfo = info;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// See if we are remapping nl_langinfo(CODESET)
|
||||
//
|
||||
if (gNLInfo && nl_langinfo_codeset) {
|
||||
nsAutoString localeKey;
|
||||
|
||||
#if HAVE_GNU_GET_LIBC_VERSION
|
||||
//
|
||||
// look for an glibc version specific charset remap
|
||||
//
|
||||
const char *glibc_version = gnu_get_libc_version();
|
||||
if ((glibc_version != nsnull) && (strlen(glibc_version))) {
|
||||
localeKey.Assign(NS_LITERAL_STRING("nllic."));
|
||||
localeKey.AppendWithConversion(glibc_version);
|
||||
localeKey.Append(NS_LITERAL_STRING("."));
|
||||
localeKey.AppendWithConversion(nl_langinfo_codeset);
|
||||
res = gNLInfo->Get(localeKey, aCharset);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
res = VerifyCharset(aCharset);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
oString = aCharset;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// look for a charset specific charset remap
|
||||
//
|
||||
localeKey.Assign(NS_LITERAL_STRING("nllic."));
|
||||
localeKey.AppendWithConversion(nl_langinfo_codeset);
|
||||
res = gNLInfo->Get(localeKey, aCharset);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
res = VerifyCharset(aCharset);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
oString = aCharset;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_ASSERTION(0, "unable to use nl_langinfo(CODESET)");
|
||||
#endif
|
||||
|
||||
//
|
||||
// try falling back on a deprecated (locale based) name
|
||||
//
|
||||
char* locale = setlocale(LC_CTYPE, nsnull);
|
||||
nsAutoString localeStr;
|
||||
localeStr.AssignWithConversion(locale);
|
||||
res = ConvertLocaleToCharsetUsingDeprecatedConfig(localeStr, aCharset);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
oString = aCharset;
|
||||
return res; // succeeded
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlatformCharset::Init()
|
||||
{
|
||||
nsString charset;
|
||||
nsresult res;
|
||||
|
||||
//
|
||||
// remember default locale so we can use the
|
||||
// same charset when asked for the same locale
|
||||
//
|
||||
char* locale = setlocale(LC_CTYPE, nsnull);
|
||||
NS_ASSERTION(locale, "cannot setlocale");
|
||||
if (locale) {
|
||||
mLocale.AssignWithConversion(locale);
|
||||
} else {
|
||||
mLocale.Assign(NS_LITERAL_STRING("en_US"));
|
||||
}
|
||||
|
||||
res = InitGetCharset(charset);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
mCharset = charset;
|
||||
return res; // succeeded
|
||||
}
|
||||
|
||||
// last resort fallback
|
||||
NS_ASSERTION(0, "unable to convert locale to charset using deprecated config");
|
||||
mCharset.Assign(NS_LITERAL_STRING("ISO-8859-1"));
|
||||
return NS_SUCCESS_USING_FALLBACK_LOCALE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::VerifyCharset(nsString &aCharset)
|
||||
{
|
||||
nsresult res;
|
||||
//
|
||||
// get the convert manager
|
||||
//
|
||||
nsCOMPtr <nsICharsetConverterManager2> charsetConverterManager;
|
||||
charsetConverterManager = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &res);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
//
|
||||
// check if we recognize the charset string
|
||||
//
|
||||
nsCOMPtr <nsIAtom> charsetAtom;
|
||||
res = charsetConverterManager->GetCharsetAtom(aCharset.get(),
|
||||
getter_AddRefs(charsetAtom));
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
//
|
||||
// check if we can get an input converter
|
||||
//
|
||||
nsCOMPtr <nsIUnicodeEncoder> enc;
|
||||
res = charsetConverterManager->GetUnicodeEncoder(charsetAtom, getter_AddRefs(enc));
|
||||
if (NS_FAILED(res)) {
|
||||
NS_ASSERTION(0, "failed to create encoder");
|
||||
return res;
|
||||
}
|
||||
|
||||
//
|
||||
// check if we can get an output converter
|
||||
//
|
||||
nsCOMPtr <nsIUnicodeDecoder> dec;
|
||||
res = charsetConverterManager->GetUnicodeDecoder(charsetAtom, getter_AddRefs(dec));
|
||||
if (NS_FAILED(res)) {
|
||||
NS_ASSERTION(0, "failed to create decoder");
|
||||
return res;
|
||||
}
|
||||
|
||||
//
|
||||
// return the preferred string
|
||||
//
|
||||
const PRUnichar *prefName;
|
||||
res = charsetAtom->GetUnicode(&prefName);
|
||||
if (NS_SUCCEEDED(res))
|
||||
aCharset.Assign(prefName);
|
||||
NS_ASSERTION(NS_SUCCEEDED(res), "failed to get preferred charset name, using non-preferred");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::MapToCharset(short script, short region, nsAString& outCharset)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::MapToCharset(nsAString& inANSICodePage, nsAString& outCharset)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::InitInfo()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsURLProperties.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsPromiseFlatString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
nsIStringBundleService* nsURLProperties::gStringBundleService = nsnull;
|
||||
nsrefcnt nsURLProperties::gRefCnt = 0;
|
||||
|
||||
nsURLProperties::nsURLProperties(const nsACString& aUrl)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (gRefCnt == 0) {
|
||||
res = CallGetService(NS_STRINGBUNDLE_CONTRACTID, &gStringBundleService);
|
||||
if (NS_FAILED(res)) return;
|
||||
gRefCnt++;
|
||||
}
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
gStringBundleService->CreateBundle(PromiseFlatCString(aUrl).get(), getter_AddRefs(mBundle));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
nsURLProperties::~nsURLProperties()
|
||||
{
|
||||
if (--gRefCnt == 0) {
|
||||
NS_RELEASE(gStringBundleService);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsURLProperties::Get(const nsAString& aKey,
|
||||
nsAString& oValue)
|
||||
{
|
||||
if(mBundle) {
|
||||
nsXPIDLString value;
|
||||
nsresult rv;
|
||||
|
||||
rv = mBundle->GetStringFromName(PromiseFlatString(aKey).get(),
|
||||
getter_Copies(value));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
oValue = value;
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsURLProperties::DidLoad(PRBool &oDidLoad)
|
||||
{
|
||||
oDidLoad = (mBundle!=nsnull);
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsURLProperties_h__
|
||||
#define nsURLProperties_h__
|
||||
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAString.h"
|
||||
|
||||
class nsURLProperties {
|
||||
public:
|
||||
nsURLProperties(const nsACString& aUrl);
|
||||
virtual ~nsURLProperties();
|
||||
|
||||
NS_IMETHOD DidLoad(PRBool&);
|
||||
NS_IMETHOD Get( const nsAString& aKey, nsAString& value);
|
||||
|
||||
private:
|
||||
static nsIStringBundleService* gStringBundleService; // to speed up getting bundles
|
||||
static nsrefcnt gRefCnt;
|
||||
|
||||
nsCOMPtr<nsIStringBundle> mBundle;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsURLProperties_h__ */
|
||||
|
||||
@@ -1,226 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsUCSupport.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
|
||||
mBytes = 1;
|
||||
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;
|
||||
mBytes =1;
|
||||
} else if( 0xC0 == (0xE0 & (*in))) {
|
||||
// 2 bytes UTF8
|
||||
mUcs4 = (PRUint32)(*in);
|
||||
mUcs4 = (mUcs4 << 6) & 0x000007C0L;
|
||||
mState=1;
|
||||
mBytes =2;
|
||||
} else if( 0xE0 == (0xF0 & (*in))) {
|
||||
// 3 bytes UTF8
|
||||
mUcs4 = (PRUint32)(*in);
|
||||
mUcs4 = (mUcs4 << 12) & 0x0000F000L;
|
||||
mState=2;
|
||||
mBytes =3;
|
||||
} else if( 0xF0 == (0xF8 & (*in))) {
|
||||
// 4 bytes UTF8
|
||||
mUcs4 = (PRUint32)(*in);
|
||||
mUcs4 = (mUcs4 << 18) & 0x001F0000L;
|
||||
mState=3;
|
||||
mBytes =4;
|
||||
} else if( 0xF8 == (0xFC & (*in))) {
|
||||
// 5 bytes UTF8
|
||||
mUcs4 = (PRUint32)(*in);
|
||||
mUcs4 = (mUcs4 << 24) & 0x03000000L;
|
||||
mState=4;
|
||||
mBytes =5;
|
||||
} else if( 0xFC == (0xFE & (*in))) {
|
||||
// 6 bytes UTF8
|
||||
mUcs4 = (PRUint32)(*in);
|
||||
mUcs4 = (mUcs4 << 30) & 0x40000000L;
|
||||
mState=5;
|
||||
mBytes =6;
|
||||
} 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);
|
||||
PRUint32 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 {
|
||||
// from Unicode 3.1, non-shortest form is illegal
|
||||
if(((2==mBytes) && (mUcs4 < 0x0080)) ||
|
||||
((3==mBytes) && (mUcs4 < 0x0800)) ||
|
||||
((4==mBytes) && (mUcs4 < 0x1000)) ||
|
||||
(5==mBytes) ||
|
||||
(6==mBytes))
|
||||
{
|
||||
res = NS_ERROR_UNEXPECTED;
|
||||
break;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsUTF8ToUnicode_h___
|
||||
#define nsUTF8ToUnicode_h___
|
||||
|
||||
// Class ID for our UTF8ToUnicode charset converter
|
||||
// {5534DDC0-DD96-11d2-8AAC-00600811A836}
|
||||
#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=UTF-8"
|
||||
|
||||
//#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
|
||||
PRUint32 mBytes;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// 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___ */
|
||||
|
||||
@@ -1,267 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "pratom.h"
|
||||
#include "unicpriv.h"
|
||||
#include "nsUConvDll.h"
|
||||
#include "nsIMappingCache.h"
|
||||
#include "nsMappingCache.h"
|
||||
#include "nsIUnicodeDecodeHelper.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsUnicodeDecodeHelper.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeDecodeHelper [implementation]
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsUnicodeDecodeHelper, nsIUnicodeDecodeHelper)
|
||||
|
||||
nsUnicodeDecodeHelper::nsUnicodeDecodeHelper()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsUnicodeDecodeHelper::~nsUnicodeDecodeHelper()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsIUnicodeDecodeHelper [implementation]
|
||||
|
||||
NS_IMETHODIMP nsUnicodeDecodeHelper::ConvertByTable(
|
||||
const char * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest,
|
||||
PRInt32 * aDestLength,
|
||||
uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable)
|
||||
{
|
||||
const char * src = aSrc;
|
||||
PRInt32 srcLen = *aSrcLength;
|
||||
PRUnichar * dest = aDest;
|
||||
PRUnichar * destEnd = aDest + *aDestLength;
|
||||
|
||||
PRUnichar med;
|
||||
PRInt32 bcr; // byte count for read
|
||||
nsresult res = NS_OK;
|
||||
|
||||
while ((srcLen > 0) && (dest < destEnd)) {
|
||||
if (!uScan(aShiftTable, NULL, (PRUint8 *)src, NS_REINTERPRET_CAST(PRUint16*, &med), srcLen,
|
||||
(PRUint32 *)&bcr)) {
|
||||
res = NS_OK_UDEC_MOREINPUT;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!uMapCode((uTable*) aMappingTable, NS_STATIC_CAST(PRUint16, med), NS_REINTERPRET_CAST(PRUint16*, dest))) {
|
||||
if (med < 0x20) {
|
||||
// somehow some table miss the 0x00 - 0x20 part
|
||||
*dest = med;
|
||||
} else {
|
||||
// Unicode replacement value for unmappable chars
|
||||
*dest = 0xfffd;
|
||||
}
|
||||
}
|
||||
|
||||
src += bcr;
|
||||
srcLen -= bcr;
|
||||
dest++;
|
||||
}
|
||||
|
||||
if ((srcLen > 0) && (res == NS_OK)) res = NS_OK_UDEC_MOREOUTPUT;
|
||||
|
||||
*aSrcLength = src - aSrc;
|
||||
*aDestLength = dest - aDest;
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeDecodeHelper::ConvertByMultiTable(
|
||||
const char * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest,
|
||||
PRInt32 * aDestLength,
|
||||
PRInt32 aTableCount,
|
||||
uRange * aRangeArray,
|
||||
uShiftTable ** aShiftTable,
|
||||
uMappingTable ** aMappingTable)
|
||||
{
|
||||
PRUint8 * src = (PRUint8 *)aSrc;
|
||||
PRInt32 srcLen = *aSrcLength;
|
||||
PRUnichar * dest = aDest;
|
||||
PRUnichar * destEnd = aDest + *aDestLength;
|
||||
|
||||
PRUnichar med;
|
||||
PRInt32 bcr; // byte count for read
|
||||
nsresult res = NS_OK;
|
||||
PRInt32 i;
|
||||
|
||||
while ((srcLen > 0) && (dest < destEnd))
|
||||
{
|
||||
PRBool done= PR_FALSE;
|
||||
PRBool passRangeCheck = PR_FALSE;
|
||||
PRBool passScan = PR_FALSE;
|
||||
for (i=0; (!done) && (i<aTableCount); i++)
|
||||
{
|
||||
if ((aRangeArray[i].min <= *src) && (*src <= aRangeArray[i].max))
|
||||
{
|
||||
passRangeCheck = PR_TRUE;
|
||||
if (uScan(aShiftTable[i], NULL, src,
|
||||
NS_REINTERPRET_CAST(PRUint16*, &med), srcLen,
|
||||
(PRUint32 *)&bcr))
|
||||
{
|
||||
passScan = PR_TRUE;
|
||||
done = uMapCode((uTable*) aMappingTable[i],
|
||||
NS_STATIC_CAST(PRUint16, med),
|
||||
NS_REINTERPRET_CAST(PRUint16*, dest));
|
||||
} // if (uScan ... )
|
||||
} // if Range
|
||||
} // for loop
|
||||
|
||||
if(passRangeCheck && (! passScan))
|
||||
{
|
||||
res = NS_OK_UDEC_MOREINPUT;
|
||||
break;
|
||||
}
|
||||
if(! done)
|
||||
{
|
||||
bcr = 1;
|
||||
if ((PRUint8)*src < 0x20) {
|
||||
// somehow some table miss the 0x00 - 0x20 part
|
||||
*dest = *src;
|
||||
} else if(*src == (PRUint8) 0xa0) {
|
||||
// handle nbsp
|
||||
*dest = 0x00a0;
|
||||
} else {
|
||||
// we need to decide how many byte we skip. We can use uScan to do this
|
||||
for (i=0; i<aTableCount; i++)
|
||||
{
|
||||
if ((aRangeArray[i].min <= *src) && (*src <= aRangeArray[i].max))
|
||||
{
|
||||
if (uScan(aShiftTable[i], NULL, src,
|
||||
NS_REINTERPRET_CAST(PRUint16*, &med), srcLen,
|
||||
(PRUint32*)&bcr))
|
||||
{
|
||||
// match the patten
|
||||
|
||||
PRInt32 k;
|
||||
for(k = 1; k < bcr; k++)
|
||||
{
|
||||
if(0 == (src[k] & 0x80))
|
||||
{ // only skip if all bytes > 0x80
|
||||
// if we hit bytes <= 0x80, skip only one byte
|
||||
bcr = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// treat it as NSBR if bcr == 1 and it is 0xa0
|
||||
*dest = ((1==bcr)&&(*src == (PRUint8)0xa0 )) ? 0x00a0 : 0xfffd;
|
||||
}
|
||||
}
|
||||
|
||||
src += bcr;
|
||||
srcLen -= bcr;
|
||||
dest++;
|
||||
} // while
|
||||
|
||||
if ((srcLen > 0) && (res == NS_OK)) res = NS_OK_UDEC_MOREOUTPUT;
|
||||
|
||||
*aSrcLength = src - (PRUint8 *)aSrc;
|
||||
*aDestLength = dest - aDest;
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeDecodeHelper::CreateCache(nsMappingCacheType aType, nsIMappingCache* aResult)
|
||||
{
|
||||
return nsMappingCache::CreateCache(aType, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeDecodeHelper::DestroyCache(nsIMappingCache aCache)
|
||||
{
|
||||
return nsMappingCache::DestroyCache(aCache);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeDecodeHelper::ConvertByFastTable(
|
||||
const char * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest,
|
||||
PRInt32 * aDestLength,
|
||||
PRUnichar * aFastTable,
|
||||
PRInt32 aTableSize)
|
||||
{
|
||||
PRUint8 * src = (PRUint8 *)aSrc;
|
||||
PRUint8 * srcEnd = src;
|
||||
PRUnichar * dest = aDest;
|
||||
|
||||
nsresult res;
|
||||
if (*aSrcLength > *aDestLength) {
|
||||
srcEnd += (*aDestLength);
|
||||
res = NS_PARTIAL_MORE_OUTPUT;
|
||||
} else {
|
||||
srcEnd += (*aSrcLength);
|
||||
res = NS_OK;
|
||||
}
|
||||
|
||||
for (; src<srcEnd;) *dest++ = aFastTable[*src++];
|
||||
|
||||
*aSrcLength = src - (PRUint8 *)aSrc;
|
||||
*aDestLength = dest - aDest;
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeDecodeHelper::CreateFastTable(
|
||||
uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable,
|
||||
PRUnichar * aFastTable,
|
||||
PRInt32 aTableSize)
|
||||
{
|
||||
PRInt32 tableSize = aTableSize;
|
||||
PRInt32 buffSize = aTableSize;
|
||||
char * buff = new char [buffSize];
|
||||
if (buff == NULL) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
char * p = buff;
|
||||
for (PRInt32 i=0; i<aTableSize; i++) *(p++) = i;
|
||||
nsresult res = ConvertByTable(buff, &buffSize, aFastTable, &tableSize,
|
||||
aShiftTable, aMappingTable);
|
||||
|
||||
delete [] buff;
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsUnicodeDecodeHelper_h__
|
||||
#define nsUnicodeDecodeHelper_h__
|
||||
|
||||
#include "nsIUnicodeDecodeHelper.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeDecodeHelper [declaration]
|
||||
|
||||
/**
|
||||
* The actual implementation of the nsIUnicodeDecodeHelper interface.
|
||||
*
|
||||
* @created 18/Mar/1998
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsUnicodeDecodeHelper : public nsIUnicodeDecodeHelper
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsUnicodeDecodeHelper();
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsUnicodeDecodeHelper();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Interface nsIUnicodeDecodeHelper [declaration]
|
||||
|
||||
NS_IMETHOD ConvertByTable(const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength, uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable);
|
||||
|
||||
NS_IMETHOD ConvertByMultiTable(const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength, PRInt32 aTableCount,
|
||||
uRange * aRangeArray, uShiftTable ** aShiftTable,
|
||||
uMappingTable ** aMappingTable);
|
||||
|
||||
NS_IMETHOD ConvertByFastTable(const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength, PRUnichar * aFastTable,
|
||||
PRInt32 aTableSize);
|
||||
|
||||
NS_IMETHOD CreateFastTable( uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable, PRUnichar * aFastTable,
|
||||
PRInt32 aTableSize);
|
||||
|
||||
NS_IMETHOD CreateCache(nsMappingCacheType aType, nsIMappingCache* aResult);
|
||||
|
||||
NS_IMETHOD DestroyCache(nsIMappingCache aResult);
|
||||
};
|
||||
|
||||
#endif // nsUnicodeDecodeHelper_h__
|
||||
|
||||
|
||||
@@ -1,170 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "pratom.h"
|
||||
#include "unicpriv.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeEncodeHelper.h"
|
||||
#include "nsUConvDll.h"
|
||||
#include "nsIMappingCache.h"
|
||||
#include "nsMappingCache.h"
|
||||
#include "nsUnicodeEncodeHelper.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeEncodeHelper [implementation]
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsUnicodeEncodeHelper, nsIUnicodeEncodeHelper)
|
||||
|
||||
nsUnicodeEncodeHelper::nsUnicodeEncodeHelper()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsUnicodeEncodeHelper::~nsUnicodeEncodeHelper()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsIUnicodeEncodeHelper [implementation]
|
||||
|
||||
NS_IMETHODIMP nsUnicodeEncodeHelper::ConvertByTable(
|
||||
const PRUnichar * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
char * aDest,
|
||||
PRInt32 * aDestLength,
|
||||
uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable)
|
||||
{
|
||||
const PRUnichar * src = aSrc;
|
||||
const PRUnichar * srcEnd = aSrc + *aSrcLength;
|
||||
char * dest = aDest;
|
||||
PRInt32 destLen = *aDestLength;
|
||||
|
||||
PRUnichar med;
|
||||
PRInt32 bcw; // byte count for write;
|
||||
nsresult res = NS_OK;
|
||||
|
||||
while (src < srcEnd) {
|
||||
if (!uMapCode((uTable*) aMappingTable, NS_STATIC_CAST(PRUnichar, *(src++)), NS_REINTERPRET_CAST(PRUint16*, &med))) {
|
||||
res = NS_ERROR_UENC_NOMAPPING;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!uGenerate(aShiftTable, 0, med, (PRUint8 *)dest, destLen,
|
||||
(PRUint32 *)&bcw)) {
|
||||
src--;
|
||||
res = NS_OK_UENC_MOREOUTPUT;
|
||||
break;
|
||||
}
|
||||
|
||||
dest += bcw;
|
||||
destLen -= bcw;
|
||||
}
|
||||
|
||||
*aSrcLength = src - aSrc;
|
||||
*aDestLength = dest - aDest;
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeEncodeHelper::ConvertByMultiTable(
|
||||
const PRUnichar * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
char * aDest,
|
||||
PRInt32 * aDestLength,
|
||||
PRInt32 aTableCount,
|
||||
uShiftTable ** aShiftTable,
|
||||
uMappingTable ** aMappingTable)
|
||||
{
|
||||
const PRUnichar * src = aSrc;
|
||||
const PRUnichar * srcEnd = aSrc + *aSrcLength;
|
||||
char * dest = aDest;
|
||||
PRInt32 destLen = *aDestLength;
|
||||
|
||||
PRUnichar med;
|
||||
PRInt32 bcw; // byte count for write;
|
||||
nsresult res = NS_OK;
|
||||
PRInt32 i;
|
||||
|
||||
while (src < srcEnd) {
|
||||
for (i=0; i<aTableCount; i++)
|
||||
if (uMapCode((uTable*) aMappingTable[i], NS_STATIC_CAST(PRUint16, *src), NS_REINTERPRET_CAST(PRUint16*, &med))) break;
|
||||
|
||||
src++;
|
||||
if (i == aTableCount) {
|
||||
res = NS_ERROR_UENC_NOMAPPING;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!uGenerate(aShiftTable[i], 0, med, (PRUint8 *)dest, destLen,
|
||||
(PRUint32 *)&bcw)) {
|
||||
src--;
|
||||
res = NS_OK_UENC_MOREOUTPUT;
|
||||
break;
|
||||
}
|
||||
|
||||
dest += bcw;
|
||||
destLen -= bcw;
|
||||
}
|
||||
|
||||
*aSrcLength = src - aSrc;
|
||||
*aDestLength = dest - aDest;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsUnicodeEncodeHelper::CreateCache(nsMappingCacheType aType, nsIMappingCache* aResult)
|
||||
{
|
||||
return nsMappingCache::CreateCache(aType, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeEncodeHelper::DestroyCache(nsIMappingCache aCache)
|
||||
{
|
||||
return nsMappingCache::DestroyCache(aCache);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeEncodeHelper::FillInfo(PRUint32 *aInfo, uMappingTable * aMappingTable)
|
||||
{
|
||||
uFillInfo((uTable*) aMappingTable, aInfo);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsUnicodeEncodeHelper::FillInfo(PRUint32 *aInfo, PRInt32 aTableCount, uMappingTable ** aMappingTable)
|
||||
{
|
||||
for (PRInt32 i=0; i<aTableCount; i++)
|
||||
uFillInfo((uTable*) aMappingTable[i], aInfo);
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsUnicodeEncodeHelper_h__
|
||||
#define nsUnicodeEncodeHelper_h__
|
||||
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeEncodeHelper.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeEncodeHelper [declaration]
|
||||
|
||||
/**
|
||||
* The actual implementation of the nsIUnicodeEncodeHelper interface.
|
||||
*
|
||||
* @created 22/Nov/1998
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsUnicodeEncodeHelper : public nsIUnicodeEncodeHelper
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsUnicodeEncodeHelper();
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsUnicodeEncodeHelper();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Interface nsIUnicodeEncodeHelper [declaration]
|
||||
|
||||
NS_IMETHOD ConvertByTable(const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
||||
char * aDest, PRInt32 * aDestLength, uShiftTable * aShiftTable,
|
||||
uMappingTable * aMappingTable);
|
||||
|
||||
NS_IMETHOD ConvertByMultiTable(const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
||||
char * aDest, PRInt32 * aDestLength, PRInt32 aTableCount,
|
||||
uShiftTable ** aShiftTable, uMappingTable ** aMappingTable);
|
||||
|
||||
NS_IMETHOD CreateCache(nsMappingCacheType aType, nsIMappingCache* aResult);
|
||||
|
||||
NS_IMETHOD DestroyCache(nsIMappingCache aCache);
|
||||
|
||||
NS_IMETHOD FillInfo(PRUint32* aInfo, uMappingTable * aMappingTable);
|
||||
NS_IMETHOD FillInfo(PRUint32* aInfo, PRInt32 aTableCount, uMappingTable ** aMappingTable);
|
||||
};
|
||||
|
||||
#endif // nsUnicodeEncodeHelper_h__
|
||||
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsUnicodeToCP1252.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static const PRUint16 g_ufMappingTable[] = {
|
||||
#include "cp1252.uf"
|
||||
};
|
||||
|
||||
static const 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, 1)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsUnicodeToCP1252_h___
|
||||
#define nsUnicodeToCP1252_h___
|
||||
|
||||
// Class ID for our UnicodeToCP1252 charset converter
|
||||
// {7B8556AC-EC79-11d2-8AAC-00600811A836}
|
||||
#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();
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsUnicodeToCP1252_h___ */
|
||||
@@ -1,62 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsUnicodeToISO88591.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static const PRUint16 g_ufMappingTable[] = {
|
||||
#include "8859-1.uf"
|
||||
};
|
||||
|
||||
static const 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, 1)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsUnicodeToISO88591_h___
|
||||
#define nsUnicodeToISO88591_h___
|
||||
|
||||
// {920307B0-C6E8-11d2-8AA8-00600811A836}
|
||||
#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();
|
||||
|
||||
};
|
||||
#endif /* nsUnicodeToISO88591_h___ */
|
||||
@@ -1,62 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsUnicodeToMacRoman.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static const PRUint16 g_MacRomanMappingTable[] = {
|
||||
#include "macroman.uf"
|
||||
};
|
||||
|
||||
static const 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, 1)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsUnicodeToMacRoman_h___
|
||||
#define nsUnicodeToMacRoman_h___
|
||||
|
||||
// Class ID for our UnicodeToMacRoman charset converter
|
||||
// {7B8556AF-EC79-11d2-8AAC-00600811A836}
|
||||
#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();
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsUnicodeToMacRoman_h___ */
|
||||
@@ -1,185 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsUnicodeToUTF8.h"
|
||||
#include <string.h>
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsUnicodeToUTF8, nsIUnicodeEncoder)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsUnicodeToUTF8 class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToUTF8::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
// aSrc is interpreted as UTF16, 3 is normally enough.
|
||||
// But when previous buffer only contains part of the surrogate pair, we
|
||||
// need to complete it here. If the first word in following buffer is not
|
||||
// in valid surrogate rang, we need to convert the remaining of last buffer
|
||||
// to 3 bytes.
|
||||
*aDestLength = 3*aSrcLength + 3;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToUTF8::FillInfo(PRUint32 *aInfo)
|
||||
{
|
||||
memset(aInfo, 0xFF, (0x10000L >> 3));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToUTF8::Convert(const PRUnichar * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
char * aDest,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
const PRUnichar * src = aSrc;
|
||||
const PRUnichar * srcEnd = aSrc + *aSrcLength;
|
||||
char * dest = aDest;
|
||||
PRInt32 destLen = *aDestLength;
|
||||
PRUint32 n;
|
||||
|
||||
//complete remaining of last conversion
|
||||
if (mHighSurrogate) {
|
||||
if (src < srcEnd) {
|
||||
*aDestLength = 0;
|
||||
return NS_OK_UENC_MOREINPUT;
|
||||
}
|
||||
if (*aDestLength < 4) {
|
||||
*aSrcLength = 0;
|
||||
*aDestLength = 0;
|
||||
return NS_OK_UENC_MOREOUTPUT;
|
||||
}
|
||||
if (*src < (PRUnichar)0xdc00 || *src > (PRUnichar)0xdfff) { //not a pair
|
||||
*dest++ = (char)0xe0 | (mHighSurrogate >> 12);
|
||||
*dest++ = (char)0x80 | ((mHighSurrogate >> 6) & 0x003f);
|
||||
*dest++ = (char)0x80 | (mHighSurrogate & 0x003f);
|
||||
destLen -= 3;
|
||||
} else {
|
||||
n = ((mHighSurrogate - (PRUnichar)0xd800) << 10) +
|
||||
(*src - (PRUnichar)0xdc00) + 0x10000;
|
||||
*dest++ = (char)0xf0 | (n >> 18);
|
||||
*dest++ = (char)0x80 | ((n >> 12) & 0x3f);
|
||||
*dest++ = (char)0x80 | ((n >> 6) & 0x3f);
|
||||
*dest++ = (char)0x80 | (n & 0x3f);
|
||||
++src;
|
||||
destLen -= 4;
|
||||
}
|
||||
mHighSurrogate = 0;
|
||||
}
|
||||
|
||||
while (src < srcEnd) {
|
||||
if ( *src < 0x007f) {
|
||||
if (destLen < 1)
|
||||
goto error_more_output;
|
||||
*dest++ = (char)*src;
|
||||
--destLen;
|
||||
} else if (*src < 0x07ff) {
|
||||
if (destLen < 2)
|
||||
goto error_more_output;
|
||||
*dest++ = (char)0xc0 | (*src >> 6);
|
||||
*dest++ = (char)0x80 | (*src & 0x003f);
|
||||
destLen -= 2;
|
||||
} else if (*src >= (PRUnichar)0xD800 && *src < (PRUnichar)0xDA00) {
|
||||
if ((src+1) >= srcEnd) {
|
||||
//we need another surrogate to complete this unicode char
|
||||
mHighSurrogate = *src;
|
||||
*aDestLength = dest - aDest;
|
||||
return NS_OK_UENC_MOREINPUT;
|
||||
}
|
||||
//handle surrogate
|
||||
if (destLen < 4)
|
||||
goto error_more_output;
|
||||
if (*(src+1) < (PRUnichar)0xdc00 || *(src+1) > 0xdfff) { //not a pair
|
||||
*dest++ = (char)0xe0 | (*src >> 12);
|
||||
*dest++ = (char)0x80 | ((*src >> 6) & 0x003f);
|
||||
*dest++ = (char)0x80 | (*src & 0x003f);
|
||||
destLen -= 3;
|
||||
} else {
|
||||
n = ((*src - (PRUnichar)0xd800) << 10) + (*(src+1) - (PRUnichar)0xdc00) + (PRUnichar)0x10000;
|
||||
*dest++ = (char)0xf0 | (n >> 18);
|
||||
*dest++ = (char)0x80 | ((n >> 12) & 0x3f);
|
||||
*dest++ = (char)0x80 | ((n >> 6) & 0x3f);
|
||||
*dest++ = (char)0x80 | (n & 0x3f);
|
||||
destLen -= 4;
|
||||
++src;
|
||||
}
|
||||
} else {
|
||||
if (destLen < 3)
|
||||
goto error_more_output;
|
||||
//treat rest of the character as BMP
|
||||
*dest++ = (char)0xe0 | (*src >> 12);
|
||||
*dest++ = (char)0x80 | ((*src >> 6) & 0x003f);
|
||||
*dest++ = (char)0x80 | (*src & 0x003f);
|
||||
destLen -= 3;
|
||||
}
|
||||
++src;
|
||||
}
|
||||
|
||||
*aDestLength = dest - aDest;
|
||||
return NS_OK;
|
||||
|
||||
error_more_output:
|
||||
*aSrcLength = src - aSrc;
|
||||
*aDestLength = dest - aDest;
|
||||
return NS_OK_UENC_MOREOUTPUT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToUTF8::Finish(char * aDest, PRInt32 * aDestLength)
|
||||
{
|
||||
char * dest = aDest;
|
||||
|
||||
if (mHighSurrogate) {
|
||||
if (*aDestLength < 3) {
|
||||
*aDestLength = 0;
|
||||
return NS_OK_UENC_MOREOUTPUT;
|
||||
}
|
||||
*dest++ = (char)0xe0 | (mHighSurrogate >> 12);
|
||||
*dest++ = (char)0x80 | ((mHighSurrogate >> 6) & 0x003f);
|
||||
*dest++ = (char)0x80 | (mHighSurrogate & 0x003f);
|
||||
mHighSurrogate = 0;
|
||||
*aDestLength = 3;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aDestLength = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsUnicodeToUTF8_h___
|
||||
#define nsUnicodeToUTF8_h___
|
||||
|
||||
// Class ID for our UnicodeToUTF8 charset converter
|
||||
// {7C657D18-EC5E-11d2-8AAC-00600811A836}
|
||||
#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=UTF-8"
|
||||
|
||||
//#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 nsIUnicodeEncoder
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsUnicodeToUTF8() {NS_INIT_REFCNT(); mHighSurrogate = 0;};
|
||||
|
||||
NS_IMETHOD FillInfo(PRUint32* aInfo);
|
||||
|
||||
NS_IMETHOD Convert(const PRUnichar * aSrc,
|
||||
PRInt32 * aSrcLength,
|
||||
char * aDest,
|
||||
PRInt32 * aDestLength);
|
||||
|
||||
NS_IMETHOD Finish(char * aDest, PRInt32 * aDestLength);
|
||||
|
||||
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength);
|
||||
|
||||
NS_IMETHOD Reset() {mHighSurrogate = 0; return NS_OK;}
|
||||
|
||||
NS_IMETHOD SetOutputErrorBehavior(PRInt32 aBehavior,
|
||||
nsIUnicharEncoder * aEncoder, PRUnichar aChar) {return NS_OK;};
|
||||
|
||||
protected:
|
||||
PRUnichar mHighSurrogate;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsUnicodeToUTF8_h___ */
|
||||
@@ -1,190 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIPlatformCharset.h"
|
||||
#include "nsURLProperties.h"
|
||||
#include "pratom.h"
|
||||
#include <windows.h>
|
||||
#include "nsUConvDll.h"
|
||||
#include "nsIWin32Locale.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsLocaleCID.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsITimelineService.h"
|
||||
#include "nsPlatformCharset.h"
|
||||
|
||||
static nsURLProperties *gInfo = nsnull;
|
||||
static PRInt32 gCnt= 0;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsPlatformCharset, nsIPlatformCharset)
|
||||
|
||||
nsPlatformCharset::nsPlatformCharset()
|
||||
{
|
||||
NS_TIMELINE_START_TIMER("nsPlatformCharset()");
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
UINT acp = ::GetACP();
|
||||
PRInt32 acpint = (PRInt32)(acp & 0x00FFFF);
|
||||
nsAutoString acpKey; acpKey.Assign(NS_LITERAL_STRING("acp."));
|
||||
acpKey.AppendInt(acpint, 10);
|
||||
nsresult res = MapToCharset(acpKey, mCharset);
|
||||
|
||||
NS_TIMELINE_STOP_TIMER("nsPlatformCharset()");
|
||||
NS_TIMELINE_MARK_TIMER("nsPlatformCharset()");
|
||||
}
|
||||
nsPlatformCharset::~nsPlatformCharset()
|
||||
{
|
||||
PR_AtomicDecrement(&gCnt);
|
||||
if ((0 == gCnt) && (nsnull != gInfo)) {
|
||||
delete gInfo;
|
||||
gInfo = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::InitInfo()
|
||||
{
|
||||
PR_AtomicIncrement(&gCnt); // count for gInfo
|
||||
|
||||
if (gInfo == nsnull) {
|
||||
nsURLProperties *info = new nsURLProperties(NS_LITERAL_CSTRING("resource:/res/wincharset.properties"));
|
||||
|
||||
NS_ASSERTION(info , "cannot open properties file");
|
||||
NS_ENSURE_TRUE(info, NS_ERROR_FAILURE);
|
||||
gInfo = info;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::MapToCharset(nsAString& inANSICodePage, nsAString& outCharset)
|
||||
{
|
||||
//delay loading wincharset.properties bundle if possible
|
||||
if (inANSICodePage.Equals(NS_LITERAL_STRING("acp.1252"))) {
|
||||
outCharset = NS_LITERAL_STRING("windows-1252");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (inANSICodePage.Equals(NS_LITERAL_STRING("acp.932"))) {
|
||||
outCharset = NS_LITERAL_STRING("Shift_JIS");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ensure the .property file is loaded
|
||||
nsresult rv = InitInfo();
|
||||
if (NS_FAILED(rv)) {
|
||||
outCharset.Assign(NS_LITERAL_STRING("windows-1252"));
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = gInfo->Get(inANSICodePage, outCharset);
|
||||
if (NS_FAILED(rv)) {
|
||||
outCharset.Assign(NS_LITERAL_STRING("windows-1252"));
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlatformCharset::GetCharset(nsPlatformCharsetSel selector, nsAString& oResult)
|
||||
{
|
||||
oResult = mCharset;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlatformCharset::GetDefaultCharsetForLocale(const PRUnichar* localeName, PRUnichar** _retValue)
|
||||
{
|
||||
nsCOMPtr<nsIWin32Locale> winLocale;
|
||||
LCID localeAsLCID;
|
||||
char acp_name[6];
|
||||
nsAutoString charset;
|
||||
nsAutoString localeAsNSString(localeName);
|
||||
|
||||
//
|
||||
// convert locale name to a code page (through the LCID)
|
||||
//
|
||||
nsresult result;
|
||||
winLocale = do_CreateInstance(NS_WIN32LOCALE_CONTRACTID, &result);
|
||||
result = winLocale->GetPlatformLocale(&localeAsNSString,&localeAsLCID);
|
||||
|
||||
if (NS_FAILED(result)) { *_retValue = ToNewUnicode(charset); return result; }
|
||||
|
||||
if (GetLocaleInfo(localeAsLCID,LOCALE_IDEFAULTANSICODEPAGE,acp_name,sizeof(acp_name))==0) {
|
||||
*_retValue = ToNewUnicode(charset);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsAutoString acp_key; acp_key.Assign(NS_LITERAL_STRING("acp."));
|
||||
acp_key.AppendWithConversion(acp_name);
|
||||
|
||||
result = MapToCharset(acp_key,charset);
|
||||
|
||||
*_retValue = ToNewUnicode(charset);
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlatformCharset::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::MapToCharset(short script, short region, nsAString& outCharset)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::InitGetCharset(nsAString &oString)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::ConvertLocaleToCharsetUsingDeprecatedConfig(nsAutoString& locale, nsAString& oResult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPlatformCharset::VerifyCharset(nsString &aCharset)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
##
|
||||
## 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) 1999 Netscape Communications Corporation. All
|
||||
## Rights Reserved.
|
||||
##
|
||||
## Contributor(s):
|
||||
##
|
||||
## This file map an OS/2 codepage to a charset name
|
||||
## We use this to figure out the charset of file system, clipboard, etc
|
||||
##
|
||||
os2.850=IBM850
|
||||
os2.852=IBM852
|
||||
os2.855=IBM855
|
||||
os2.857=IBM857
|
||||
os2.862=IBM862
|
||||
os2.864=IBM864
|
||||
os2.866=IBM866
|
||||
os2.874=TIS-620
|
||||
os2.932=Shift_JIS
|
||||
os2.936=GB2312
|
||||
os2.949=EUC-KR
|
||||
os2.950=Big5
|
||||
os2.1381=GB2312
|
||||
os2.1386=GB2312
|
||||
os2.813=ISO-8859-7
|
||||
os2.915=ISO-8859-5
|
||||
os2.1004=ISO-8859-1
|
||||
@@ -1,58 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef ubase_h__
|
||||
#define ubase_h__
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef NS_WIN32
|
||||
#define NS_WIN32 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__unix)
|
||||
#ifndef NS_UNIX
|
||||
#define NS_UNIX 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
#define PRIVATE
|
||||
#define MODULE_PRIVATE
|
||||
|
||||
#endif
|
||||
@@ -1,987 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* jeroen.dobbelaere@acunia.com
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "unicpriv.h"
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
typedef PRBool (*uSubGeneratorFunc) (PRUint16 in, unsigned char* out);
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
|
||||
typedef PRBool (*uGeneratorFunc) (
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
MODULE_PRIVATE PRBool uGenerate(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
#define uSubGennerator(sub,in,out) (* m_subgenerator[sub])((in),(out))
|
||||
|
||||
PRIVATE PRBool uCheckAndGenAlways1Byte(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndGenAlways2Byte(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndGenAlways2ByteShiftGR(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndGenByTable(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8F(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA2(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGenAlways2ByteSwap(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGenAlways4Byte(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGenAlways4ByteSwap(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA3(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA4(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA5(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA6(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA7(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndGenAlways1ByteShiftGL(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCnGAlways8BytesDecomposedHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCnGAlways6BytesGLDecomposedHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGenJohabHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGenJohabSymbol(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
|
||||
PRIVATE PRBool uCheckAndGen4BytesGB18030(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
|
||||
PRIVATE PRBool uGenDecomposedHangulCommon(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen,
|
||||
PRUint8 mask,
|
||||
PRUint16 nbyte
|
||||
);
|
||||
|
||||
PRIVATE PRBool uGenAlways2Byte(
|
||||
PRUint16 in,
|
||||
unsigned char* out
|
||||
);
|
||||
PRIVATE PRBool uGenAlways2ByteShiftGR(
|
||||
PRUint16 in,
|
||||
unsigned char* out
|
||||
);
|
||||
PRIVATE PRBool uGenAlways1Byte(
|
||||
PRUint16 in,
|
||||
unsigned char* out
|
||||
);
|
||||
PRIVATE PRBool uGenAlways1BytePrefix8E(
|
||||
PRUint16 in,
|
||||
unsigned char* out
|
||||
);
|
||||
PRIVATE PRBool uGenAlways2ByteUTF8(
|
||||
PRUint16 in,
|
||||
unsigned char* out
|
||||
);
|
||||
PRIVATE PRBool uGenAlways3ByteUTF8(
|
||||
PRUint16 in,
|
||||
unsigned char* out
|
||||
);
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE uGeneratorFunc m_generator[uNumOfCharsetType] =
|
||||
{
|
||||
uCheckAndGenAlways1Byte,
|
||||
uCheckAndGenAlways2Byte,
|
||||
uCheckAndGenByTable,
|
||||
uCheckAndGenAlways2ByteShiftGR,
|
||||
uCheckAndGen2ByteGRPrefix8F,
|
||||
uCheckAndGen2ByteGRPrefix8EA2,
|
||||
uCheckAndGenAlways2ByteSwap,
|
||||
uCheckAndGenAlways4Byte,
|
||||
uCheckAndGenAlways4ByteSwap,
|
||||
uCheckAndGen2ByteGRPrefix8EA3,
|
||||
uCheckAndGen2ByteGRPrefix8EA4,
|
||||
uCheckAndGen2ByteGRPrefix8EA5,
|
||||
uCheckAndGen2ByteGRPrefix8EA6,
|
||||
uCheckAndGen2ByteGRPrefix8EA7,
|
||||
uCheckAndGenAlways1ByteShiftGL,
|
||||
uCnGAlways8BytesDecomposedHangul,
|
||||
uCnGAlways6BytesGLDecomposedHangul,
|
||||
uCheckAndGenJohabHangul,
|
||||
uCheckAndGenJohabSymbol,
|
||||
uCheckAndGen4BytesGB18030,
|
||||
uCheckAndGenAlways2Byte /* place-holder for GR128 */
|
||||
};
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
|
||||
PRIVATE uSubGeneratorFunc m_subgenerator[uNumOfCharType] =
|
||||
{
|
||||
uGenAlways1Byte,
|
||||
uGenAlways2Byte,
|
||||
uGenAlways2ByteShiftGR,
|
||||
uGenAlways1BytePrefix8E,
|
||||
uGenAlways2ByteUTF8,
|
||||
uGenAlways3ByteUTF8
|
||||
|
||||
};
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
MODULE_PRIVATE PRBool uGenerate(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
return (* m_generator[shift->classID]) (shift,state,in,out,outbuflen,outlen);
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uGenAlways1Byte(
|
||||
PRUint16 in,
|
||||
unsigned char* out
|
||||
)
|
||||
{
|
||||
out[0] = (unsigned char)in;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uGenAlways2Byte(
|
||||
PRUint16 in,
|
||||
unsigned char* out
|
||||
)
|
||||
{
|
||||
out[0] = (unsigned char)((in >> 8) & 0xff);
|
||||
out[1] = (unsigned char)(in & 0xff);
|
||||
return PR_TRUE;
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uGenAlways2ByteShiftGR(
|
||||
PRUint16 in,
|
||||
unsigned char* out
|
||||
)
|
||||
{
|
||||
out[0] = (unsigned char)(((in >> 8) & 0xff) | 0x80);
|
||||
out[1] = (unsigned char)((in & 0xff) | 0x80);
|
||||
return PR_TRUE;
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uGenAlways1BytePrefix8E(
|
||||
PRUint16 in,
|
||||
unsigned char* out
|
||||
)
|
||||
{
|
||||
out[0] = 0x8E;
|
||||
out[1] = (unsigned char)(in & 0xff);
|
||||
return PR_TRUE;
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uGenAlways2ByteUTF8(
|
||||
PRUint16 in,
|
||||
unsigned char* out
|
||||
)
|
||||
{
|
||||
out[0] = (unsigned char)(0xC0 | (( in >> 6 ) & 0x1F));
|
||||
out[1] = (unsigned char)(0x80 | (( in ) & 0x3F));
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uGenAlways3ByteUTF8(
|
||||
PRUint16 in,
|
||||
unsigned char* out
|
||||
)
|
||||
{
|
||||
out[0] = (unsigned char)(0xE0 | (( in >> 12 ) & 0x0F));
|
||||
out[1] = (unsigned char)(0x80 | (( in >> 6 ) & 0x3F));
|
||||
out[2] = (unsigned char)(0x80 | (( in ) & 0x3F));
|
||||
return PR_TRUE;
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGenAlways1Byte(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
/* Don't check inlen. The caller should ensure it is larger than 0 */
|
||||
/* Oops, I don't agree. Code changed to check every time. [CATA] */
|
||||
if(outbuflen < 1)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = 1;
|
||||
out[0] = in & 0xff;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGenAlways2Byte(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 2)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = 2;
|
||||
out[0] = ((in >> 8 ) & 0xff);
|
||||
out[1] = in & 0xff;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGenAlways2ByteShiftGR(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 2)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = 2;
|
||||
out[0] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[1] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGenByTable(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
PRInt16 i;
|
||||
uShiftCell* cell = &(shift->shiftcell[0]);
|
||||
PRInt16 itemnum = shift->numOfItem;
|
||||
unsigned char inH, inL;
|
||||
inH = (in >> 8) & 0xff;
|
||||
inL = (in & 0xff );
|
||||
for(i=0;i<itemnum;i++)
|
||||
{
|
||||
if( ( inL >= cell[i].shiftout_MinLB) &&
|
||||
( inL <= cell[i].shiftout_MaxLB) &&
|
||||
( inH >= cell[i].shiftout_MinHB) &&
|
||||
( inH <= cell[i].shiftout_MaxHB) )
|
||||
{
|
||||
if(outbuflen < cell[i].reserveLen)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = cell[i].reserveLen;
|
||||
return (uSubGennerator(cell[i].classID,in,out));
|
||||
}
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8F( uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 3)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = 3;
|
||||
out[0] = 0x8F;
|
||||
out[1] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[2] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA2( uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = 4;
|
||||
out[0] = 0x8E;
|
||||
out[1] = 0xA2;
|
||||
out[2] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[3] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGenAlways2ByteSwap(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 2)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = 2;
|
||||
out[0] = in & 0xff;
|
||||
out[1] = ((in >> 8 ) & 0xff);
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGenAlways4Byte(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = 4;
|
||||
out[0] = out[1] = 0x00;
|
||||
out[2] = ((in >> 8 ) & 0xff);
|
||||
out[3] = in & 0xff;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGenAlways4ByteSwap(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = 4;
|
||||
out[0] = ((in >> 8 ) & 0xff);
|
||||
out[1] = in & 0xff;
|
||||
out[2] = out[3] = 0x00;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA3( uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = 4;
|
||||
out[0] = 0x8E;
|
||||
out[1] = 0xA3;
|
||||
out[2] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[3] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA4( uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = 4;
|
||||
out[0] = 0x8E;
|
||||
out[1] = 0xA4;
|
||||
out[2] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[3] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA5( uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = 4;
|
||||
out[0] = 0x8E;
|
||||
out[1] = 0xA5;
|
||||
out[2] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[3] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA6( uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = 4;
|
||||
out[0] = 0x8E;
|
||||
out[1] = 0xA6;
|
||||
out[2] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[3] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA7( uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = 4;
|
||||
out[0] = 0x8E;
|
||||
out[1] = 0xA7;
|
||||
out[2] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[3] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGenAlways1ByteShiftGL(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
/* Don't check inlen. The caller should ensure it is larger than 0 */
|
||||
/* Oops, I don't agree. Code changed to check every time. [CATA] */
|
||||
if(outbuflen < 1)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
*outlen = 1;
|
||||
out[0] = in & 0x7f;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
#define SBase 0xAC00
|
||||
#define LCount 19
|
||||
#define VCount 21
|
||||
#define TCount 28
|
||||
#define NCount (VCount * TCount)
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uGenDecomposedHangulCommon(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen,
|
||||
PRUint8 mask,
|
||||
PRUint16 nbyte
|
||||
)
|
||||
{
|
||||
if(outbuflen < 8)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
static PRUint8 lMap[LCount] = {
|
||||
0xa1, 0xa2, 0xa4, 0xa7, 0xa8, 0xa9, 0xb1, 0xb2, 0xb3, 0xb5,
|
||||
0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe
|
||||
};
|
||||
|
||||
static PRUint8 tMap[TCount] = {
|
||||
0xd4, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa9, 0xaa,
|
||||
0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb4, 0xb5,
|
||||
0xb6, 0xb7, 0xb8, 0xba, 0xbb, 0xbc, 0xbd, 0xbe
|
||||
};
|
||||
PRUint16 SIndex, LIndex, VIndex, TIndex;
|
||||
PRUint16 offset;
|
||||
/* the following line are copy from Unicode 2.0 page 3-13 */
|
||||
/* item 1 of Hangul Syllabel Decomposition */
|
||||
SIndex = in - SBase;
|
||||
|
||||
/* the following lines are copy from Unicode 2.0 page 3-14 */
|
||||
/* item 2 of Hangul Syllabel Decomposition w/ modification */
|
||||
LIndex = SIndex / NCount;
|
||||
VIndex = (SIndex % NCount) / TCount;
|
||||
TIndex = SIndex % TCount;
|
||||
|
||||
*outlen = nbyte;
|
||||
offset = nbyte == 6 ? 0 : 2;
|
||||
out[0] = out[2] = out[4] = 0xa4 & mask;
|
||||
out[1+offset] = lMap[LIndex] & mask;
|
||||
out[3+offset] = (VIndex + 0xbf) & mask;
|
||||
out[5+offset] = tMap[TIndex] & mask;
|
||||
if ( nbyte == 8 )
|
||||
{
|
||||
out[6] = 0xa4 & mask;
|
||||
out[1] = 0xd4 & mask;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
PRIVATE PRBool uCnGAlways8BytesDecomposedHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
return uGenDecomposedHangulCommon(shift,state,in,out,outbuflen,outlen,0xff,8);
|
||||
}
|
||||
/*
|
||||
For rendering of Hangul in X11 with fonts with glyphs for only
|
||||
2350 syllables, drop the first 2bytes anchoring the representation
|
||||
of Hangul syllables with 8byte sequence.
|
||||
*/
|
||||
PRIVATE PRBool uCnGAlways6BytesGLDecomposedHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
return uGenDecomposedHangulCommon(shift,state,in,out,outbuflen,outlen,0x7f,6);
|
||||
}
|
||||
PRIVATE PRBool uCheckAndGenJohabHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 2)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
/*
|
||||
See Table 4-45 (page 183) of CJKV Information Processing
|
||||
for detail explaination of the following table
|
||||
*/
|
||||
/*
|
||||
static PRUint8 lMap[LCount] = {
|
||||
2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20
|
||||
};
|
||||
Therefore lMap[i] == i+2;
|
||||
*/
|
||||
|
||||
static PRUint8 vMap[VCount] = {
|
||||
/* no 0,1,2 */
|
||||
3,4,5,6,7, /* no 8,9 */
|
||||
10,11,12,13,14,15, /* no 16,17 */
|
||||
18,19,20,21,22,23, /* no 24,25 */
|
||||
26,27,28,29
|
||||
};
|
||||
static PRUint8 tMap[TCount] = {
|
||||
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17, /* no 18 */
|
||||
19,20,21,22,23,24,25,26,27,28,29
|
||||
};
|
||||
PRUint16 SIndex, LIndex, VIndex, TIndex, ch;
|
||||
/* the following line are copy from Unicode 2.0 page 3-13 */
|
||||
/* item 1 of Hangul Syllabel Decomposition */
|
||||
SIndex = in - SBase;
|
||||
|
||||
/* the following lines are copy from Unicode 2.0 page 3-14 */
|
||||
/* item 2 of Hangul Syllabel Decomposition w/ modification */
|
||||
LIndex = SIndex / NCount;
|
||||
VIndex = (SIndex % NCount) / TCount;
|
||||
TIndex = SIndex % TCount;
|
||||
|
||||
*outlen = 2;
|
||||
ch = 0x8000 |
|
||||
((LIndex+2)<<10) |
|
||||
(vMap[VIndex]<<5)|
|
||||
tMap[TIndex];
|
||||
out[0] = (ch >> 8);
|
||||
out[1] = ch & 0x00FF;
|
||||
#if 0
|
||||
printf("Johab Hangul %x %x in=%x L=%d V=%d T=%d\n", out[0], out[1], in, LIndex, VIndex, TIndex);
|
||||
#endif
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
PRIVATE PRBool uCheckAndGenJohabSymbol(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 2)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
/* The following code are based on the Perl code listed under
|
||||
* "ISO-2022-KR or EUC-KR to Johab Conversion" (page 1013)
|
||||
* in the book "CJKV Information Processing" by
|
||||
* Ken Lunde <lunde@adobe.com>
|
||||
*
|
||||
* sub convert2johab($) { # Convert ISO-2022-KR or EUC-KR to Johab
|
||||
* my @euc = unpack("C*", $_[0]);
|
||||
* my ($fe_off, $hi_off, $lo_off) = (0,0,1);
|
||||
* my @out = ();
|
||||
* while(($hi, $lo) = splice(@euc, 0, 2)) {
|
||||
* $hi &= 127; $lo &= 127;
|
||||
* $fe_off = 21 if $hi == 73;
|
||||
* $fe_off = 34 if $hi == 126;
|
||||
* ($hi_off, $lo_off) = ($lo_off, $hi_off) if ($hi <74 or $hi >125);
|
||||
* push(@out, ((($hi+$hi_off) >> 1)+ ($hi <74 ? 200:187)- $fe_off),
|
||||
* $lo + ((($hi+$lo_off) & 1) ? ($lo > 110 ? 34:16):128));
|
||||
* }
|
||||
* return pack("C*", @out);
|
||||
*/
|
||||
|
||||
unsigned char fe_off = 0;
|
||||
unsigned char hi_off = 0;
|
||||
unsigned char lo_off = 1;
|
||||
unsigned char hi = (in >> 8) & 0x7F;
|
||||
unsigned char lo = in & 0x7F;
|
||||
if(73 == hi)
|
||||
fe_off = 21;
|
||||
if(126 == hi)
|
||||
fe_off = 34;
|
||||
if( (hi < 74) || ( hi > 125) )
|
||||
{
|
||||
hi_off = 1;
|
||||
lo_off = 0;
|
||||
}
|
||||
*outlen = 2;
|
||||
out[0] = ((hi+hi_off) >> 1) + ((hi<74) ? 200 : 187 ) - fe_off;
|
||||
out[1] = lo + (((hi+lo_off) & 1) ? ((lo > 110) ? 34 : 16) :
|
||||
128);
|
||||
#if 0
|
||||
printf("Johab Symbol %x %x in=%x\n", out[0], out[1], in);
|
||||
#endif
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
PRIVATE PRBool uCheckAndGen4BytesGB18030(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
out[0] = (in / (10*126*10)) + 0x81;
|
||||
in %= (10*126*10);
|
||||
out[1] = (in / (10*126)) + 0x30;
|
||||
in %= (10*126);
|
||||
out[2] = (in / (10)) + 0x81;
|
||||
out[3] = (in % 10) + 0x30;
|
||||
*outlen = 4;
|
||||
return PR_TRUE;
|
||||
}
|
||||
@@ -1,225 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* jeroen.dobbelaere@acunia.com
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* #include "PRIntlpriv.h" */
|
||||
#include "unicpriv.h"
|
||||
|
||||
|
||||
typedef PRUint16 (* MapFormatFunc)(PRUint16 in,const uTable *uT,const uMapCell *cell);
|
||||
typedef PRBool (* HitFormateFunc)(PRUint16 in,const uMapCell *cell);
|
||||
typedef void (* FillInfoFormateFunc)(const uTable *uT, const uMapCell *cell, PRUint32* info);
|
||||
|
||||
|
||||
PRIVATE PRBool uHitFormate0(PRUint16 in,const uMapCell *cell);
|
||||
PRIVATE PRBool uHitFormate2(PRUint16 in,const uMapCell *cell);
|
||||
PRIVATE PRUint16 uMapFormate0(PRUint16 in,const uTable *uT,const uMapCell *cell);
|
||||
PRIVATE PRUint16 uMapFormate1(PRUint16 in,const uTable *uT,const uMapCell *cell);
|
||||
PRIVATE PRUint16 uMapFormate2(PRUint16 in,const uTable *uT,const uMapCell *cell);
|
||||
PRIVATE void uFillInfoFormate0(const uTable *uT,const uMapCell *cell,PRUint32* aInfo);
|
||||
PRIVATE void uFillInfoFormate1(const uTable *uT,const uMapCell *cell,PRUint32* aInfo);
|
||||
PRIVATE void uFillInfoFormate2(const uTable *uT,const uMapCell *cell,PRUint32* aInfo);
|
||||
|
||||
|
||||
PRIVATE const uMapCell *uGetMapCell(const uTable *uT, PRInt16 item);
|
||||
PRIVATE char uGetFormat(const uTable *uT, PRInt16 item);
|
||||
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE const MapFormatFunc m_map[uNumFormatTag] =
|
||||
{
|
||||
uMapFormate0,
|
||||
uMapFormate1,
|
||||
uMapFormate2,
|
||||
};
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE const FillInfoFormateFunc m_fillinfo[uNumFormatTag] =
|
||||
{
|
||||
uFillInfoFormate0,
|
||||
uFillInfoFormate1,
|
||||
uFillInfoFormate2,
|
||||
};
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE const HitFormateFunc m_hit[uNumFormatTag] =
|
||||
{
|
||||
uHitFormate0,
|
||||
uHitFormate0,
|
||||
uHitFormate2,
|
||||
};
|
||||
|
||||
#define uHit(format,in,cell) (* m_hit[(format)])((in),(cell))
|
||||
#define uMap(format,in,uT,cell) (* m_map[(format)])((in),(uT),(cell))
|
||||
#define uFillInfoCell(format,uT,cell,info) (* m_fillinfo[(format)])((uT),(cell),(info))
|
||||
#define uGetMapCell(uT, item) ((uMapCell *)(((PRUint16 *)uT) + (uT)->offsetToMapCellArray + (item)*(UMAPCELL_SIZE/sizeof(PRUint16))))
|
||||
#define uGetFormat(uT, item) (((((PRUint16 *)uT) + (uT)->offsetToFormatArray)[(item)>> 2 ] >> (((item)% 4 ) << 2)) & 0x0f)
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
MODULE_PRIVATE void uFillInfo(const uTable *uT, PRUint32* aInfo)
|
||||
{
|
||||
PRUint16 itemOfList = uT->itemOfList;
|
||||
PRUint16 i;
|
||||
for(i=0;i<itemOfList;i++)
|
||||
{
|
||||
const uMapCell* uCell;
|
||||
PRInt8 format = uGetFormat(uT,i);
|
||||
uCell = uGetMapCell(uT,i);
|
||||
uFillInfoCell(format, uT, uCell, aInfo);
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
MODULE_PRIVATE PRBool uMapCode(const uTable *uT, PRUint16 in, PRUint16* out)
|
||||
{
|
||||
PRBool done = PR_FALSE;
|
||||
PRUint16 itemOfList = uT->itemOfList;
|
||||
PRUint16 i;
|
||||
*out = NOMAPPING;
|
||||
for(i=0;i<itemOfList;i++)
|
||||
{
|
||||
const uMapCell* uCell;
|
||||
PRInt8 format = uGetFormat(uT,i);
|
||||
uCell = uGetMapCell(uT,i);
|
||||
if(uHit(format, in, uCell))
|
||||
{
|
||||
*out = uMap(format, in, uT,uCell);
|
||||
done = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ( done && (*out != NOMAPPING));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
member function
|
||||
*/
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uHitFormate0(PRUint16 in,const uMapCell *cell)
|
||||
{
|
||||
return ( (in >= cell->fmt.format0.srcBegin) &&
|
||||
(in <= cell->fmt.format0.srcEnd) ) ;
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uHitFormate2(PRUint16 in,const uMapCell *cell)
|
||||
{
|
||||
return (in == cell->fmt.format2.srcBegin);
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRUint16 uMapFormate0(PRUint16 in,const uTable *uT,const uMapCell *cell)
|
||||
{
|
||||
return ((in - cell->fmt.format0.srcBegin) + cell->fmt.format0.destBegin);
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRUint16 uMapFormate1(PRUint16 in,const uTable *uT,const uMapCell *cell)
|
||||
{
|
||||
return (*(((PRUint16 *)uT) + uT->offsetToMappingTable
|
||||
+ cell->fmt.format1.mappingOffset + in - cell->fmt.format1.srcBegin));
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRUint16 uMapFormate2(PRUint16 in,const uTable *uT,const uMapCell *cell)
|
||||
{
|
||||
return (cell->fmt.format2.destBegin);
|
||||
}
|
||||
|
||||
#define SET_REPRESENTABLE(info, c) (info)[(c) >> 5] |= (1L << ((c) & 0x1f))
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE void uFillInfoFormate0(const uTable *uT,const uMapCell *cell,PRUint32* info)
|
||||
{
|
||||
PRUint16 begin, end, i;
|
||||
begin = cell->fmt.format0.srcBegin;
|
||||
end = cell->fmt.format0.srcEnd;
|
||||
if( (begin >> 5) == (end >> 5)) /* High 17 bits are the same */
|
||||
{
|
||||
for(i = begin; i <= end; i++)
|
||||
SET_REPRESENTABLE(info, i);
|
||||
}
|
||||
else {
|
||||
PRUint32 b = begin >> 5;
|
||||
PRUint32 e = end >> 5;
|
||||
info[ b ] |= (0xFFFFFFFFL << ((begin) & 0x1f));
|
||||
info[ e ] |= (0xFFFFFFFFL >> (31 - ((end) & 0x1f)));
|
||||
for(b++ ; b < e ; b++)
|
||||
info[b] |= 0xFFFFFFFFL;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE void uFillInfoFormate1(const uTable *uT,const uMapCell *cell,PRUint32* info)
|
||||
{
|
||||
PRUint16 begin, end, i;
|
||||
PRUint16 *base;
|
||||
begin = cell->fmt.format0.srcBegin;
|
||||
end = cell->fmt.format0.srcEnd;
|
||||
base = (((PRUint16 *)uT) + uT->offsetToMappingTable + cell->fmt.format1.mappingOffset);
|
||||
for(i = begin; i <= end; i++)
|
||||
{
|
||||
if(0xFFFD != base[i - begin]) /* check every item */
|
||||
SET_REPRESENTABLE(info, i);
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE void uFillInfoFormate2(const uTable *uT,const uMapCell *cell,PRUint32* info)
|
||||
{
|
||||
SET_REPRESENTABLE(info, cell->fmt.format2.srcBegin);
|
||||
}
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* jeroen.dobbelaere@acunia.com
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef __UMAP__
|
||||
#define __UMAP__
|
||||
|
||||
#define NOMAPPING 0xfffd
|
||||
|
||||
enum {
|
||||
uFormat0Tag = 0,
|
||||
uFormat1Tag,
|
||||
uFormat2Tag,
|
||||
uNumFormatTag
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
PRUint16 srcBegin; /* 2 byte */
|
||||
PRUint16 srcEnd; /* 2 byte */
|
||||
PRUint16 destBegin; /* 2 byte */
|
||||
} uFormat0;
|
||||
|
||||
typedef struct {
|
||||
PRUint16 srcBegin; /* 2 byte */
|
||||
PRUint16 srcEnd; /* 2 byte */
|
||||
PRUint16 mappingOffset; /* 2 byte */
|
||||
} uFormat1;
|
||||
|
||||
typedef struct {
|
||||
PRUint16 srcBegin; /* 2 byte */
|
||||
PRUint16 srcEnd; /* 2 byte -waste */
|
||||
PRUint16 destBegin; /* 2 byte */
|
||||
} uFormat2;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
uFormat0 format0;
|
||||
uFormat1 format1;
|
||||
uFormat2 format2;
|
||||
} fmt;
|
||||
} uMapCell;
|
||||
|
||||
#define UMAPCELL_SIZE (3*sizeof(PRUint16))
|
||||
|
||||
typedef struct {
|
||||
PRUint16 itemOfList;
|
||||
PRUint16 offsetToFormatArray;
|
||||
PRUint16 offsetToMapCellArray;
|
||||
PRUint16 offsetToMappingTable;
|
||||
PRUint16 data[1];
|
||||
} uTable;
|
||||
|
||||
#endif
|
||||
@@ -1,74 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef __UNIPRIV__
|
||||
#define __UNIPRIV__
|
||||
|
||||
#include "ubase.h"
|
||||
#include "umap.h"
|
||||
#include "uconvutil.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void uFillInfo(const uTable *uT,
|
||||
PRUint32 *info);
|
||||
|
||||
PRBool uMapCode(const uTable *uT,
|
||||
PRUint16 in,
|
||||
PRUint16* out);
|
||||
|
||||
PRBool uGenerate( uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen);
|
||||
|
||||
PRBool uScan( uShiftTable *shift,
|
||||
PRInt32 *state,
|
||||
unsigned char *in,
|
||||
PRUint16 *out,
|
||||
PRUint32 inbuflen,
|
||||
PRUint32* inscanlen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __UNIPRIV__ */
|
||||
@@ -1,605 +0,0 @@
|
||||
##
|
||||
## NOTE: THIS FILE IS DEPRECATED
|
||||
## except for those *nix systems that do not support
|
||||
## nl_langinfo(CODESET) this file should not be used
|
||||
##
|
||||
##
|
||||
## 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) 1999 Netscape Communications Corporation. All
|
||||
## Rights Reserved.
|
||||
##
|
||||
## Contributor(s):
|
||||
##
|
||||
##
|
||||
## Platform specific section.
|
||||
## Map a given locale name in a particular platform (OS) to a charset name
|
||||
## This have highgher priority than the all section
|
||||
## Use this section to overwrite those locale name which *CONFLICT WITH*
|
||||
## most other platform
|
||||
## Do not use this section if the locale is unique in the platform. Only use
|
||||
## this when it have CONFLICT w/ other platform.
|
||||
##
|
||||
## Example, most platform use EUC-JP in "japanese" locale, but
|
||||
## hpux, unixware, and sco use Shift_JIS, so we put
|
||||
## locale.all.japanese=EUC-JP
|
||||
## in the all platform section and put
|
||||
## locale.HP-UXB.10.japanese=Shift_JIS
|
||||
## locale.SCOOS5.0.japanese=Shift_JIS
|
||||
## in the platform specific section
|
||||
##
|
||||
## The key is "locale." + OSTYPE + "." + locale name
|
||||
## Read mozilla/config/config.mk to find out the correct OSTYPE
|
||||
## for your system.
|
||||
##
|
||||
## References:
|
||||
## Solaris - http://www.sun.com/software/white-papers/wp-unicode/
|
||||
## - http://www.sun.com/software/white-papers/wp-eurocurrency/
|
||||
## - http://www.sun.com/software/white-papers/wp-cttlanguage/
|
||||
## AIX - http://www.software.ibm.com/ts/mqseries/library/manuals/amqaac/AMQAAC2Q.HTM
|
||||
## <have not check the following>
|
||||
## http://www.rs6000.ibm.com/doc_link/en_US/a_doc_lib/aixbman/baseadmn/locale.htm
|
||||
## HP - http://www.hp.com/unixwork/euro/release_notes/index.html
|
||||
## <have not check the following>
|
||||
## IRIX -
|
||||
##
|
||||
locale.HP-UXB.10.japanese=Shift_JIS
|
||||
locale.SCOOS5.0.japanese=Shift_JIS
|
||||
##
|
||||
## All platform section
|
||||
## Put the general locale to charset mapping here.
|
||||
## If somehow two platform use the same locale name with different
|
||||
## charset, put the least common one in the platform specific section
|
||||
## This section have lower priority than the platform specific section
|
||||
##
|
||||
## The key is "locale.all." + locale name
|
||||
# AIX
|
||||
locale.all.ar_AA=ISO-8859-6
|
||||
# AIX
|
||||
#locale.all.Ar_AA=IBM-1046
|
||||
# Solaris
|
||||
locale.all.Ar_ARM=ISO-8859-6
|
||||
locale.all.american.iso88591=ISO-8859-1
|
||||
locale.all.bulgarian=ISO-8859-2
|
||||
locale.all.bg_BG.ISO8859-5=ISO-8859-5
|
||||
# AIX
|
||||
locale.all.bg_BG=ISO-8859-5
|
||||
locale.all.C=ISO-8859-1
|
||||
# HP
|
||||
locale.all.C.iso885915=ISO-8859-15
|
||||
locale.all.c-french.iso88591=ISO-8859-1
|
||||
locale.all.chinese=GB2312
|
||||
locale.all.chinese-s=GB2312
|
||||
locale.all.chinese-t.big5=Big5
|
||||
locale.all.cs=ISO-8859-2
|
||||
locale.all.cs_CZ=ISO-8859-2
|
||||
locale.all.cs_CZ.ISO8859-2=ISO-8859-2
|
||||
locale.all.cs_CZ.88592=ISO-8859-2
|
||||
locale.all.czech=ISO-8859-2
|
||||
locale.all.da=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.da.ISO8859-15=ISO-8859-15
|
||||
locale.all.da_DK.ISO8859-15=ISO-8859-15
|
||||
locale.all.da_DK.ISO8859-15@euro=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.da.ISO8859-15@euro=ISO-8859-15
|
||||
locale.all.da_DK.88591=ISO-8859-1
|
||||
# HP
|
||||
locale.all.da_DK.iso885915@euro=ISO-8859-15
|
||||
locale.all.da_DK.ISO8859-1=ISO-8859-1
|
||||
locale.all.da_DK=ISO-8859-1
|
||||
# AIX
|
||||
#locale.all.Da_DK=IBM-850
|
||||
locale.all.danish.iso88591=ISO-8859-1
|
||||
locale.all.dutch.iso88591=ISO-8859-1
|
||||
locale.all.de=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.de.ISO8859-15=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.de.ISO8859-15@euro=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.de.UTF-8=UTF-8
|
||||
# Solaris
|
||||
locale.all.de.UTF-8@euro=UTF-8
|
||||
locale.all.de_AT=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.de_AT.ISO8859-15=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.de_AT.ISO8859-15@euro=ISO-8859-15
|
||||
locale.all.de_CH=ISO-8859-1
|
||||
locale.all.de_CH.88591=ISO-8859-1
|
||||
locale.all.de_CH.ISO8859-1=ISO-8859-1
|
||||
locale.all.de_DE.ISO8859-15=ISO-8859-15
|
||||
locale.all.de_DE.ISO8859-15@euro=ISO-8859-15
|
||||
# AIX
|
||||
#locale.all.De_CH=IBM-850
|
||||
locale.all.de_DE=ISO-8859-1
|
||||
locale.all.de_DE.88591=ISO-8859-1
|
||||
# HP
|
||||
locale.all.de_DE.iso885915=ISO-8859-15
|
||||
# HP
|
||||
locale.all.de_DE.iso885915@euro=ISO-8859-15
|
||||
locale.all.de_DE.ISO8859-1=ISO-8859-1
|
||||
# AIX
|
||||
#locale.all.De_DE=IBM-850
|
||||
# Solaris
|
||||
locale.all.el_GR.ISO8859-7=ISO-8859-7
|
||||
locale.all.el_GR.ISO8859-7@euro=ISO-8859-7
|
||||
locale.all.en_AU.ISO8859-1=ISO-8859-1
|
||||
locale.all.en_CA.ISO8859-1=ISO-8859-1
|
||||
# AIX
|
||||
locale.all.el_GR=ISO-8859-7
|
||||
locale.all.en=ISO-8859-1
|
||||
locale.all.en_AU=ISO-8859-1
|
||||
locale.all.en_CA=ISO-8859-1
|
||||
locale.all.en_GB=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.en_GB.ISO8859-15=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.en_GB.ISO8859-15@euro=ISO-8859-15
|
||||
locale.all.en_GB.88591=ISO-8859-1
|
||||
locale.all.en_GB.ISO8859-1=ISO-8859-1
|
||||
# HP
|
||||
locale.all.en_GB.iso885915@euro=ISO-8859-15
|
||||
# AIX
|
||||
#locale.all.En_GB=IBM-850
|
||||
# Solaris
|
||||
locale.all.en_IE.ISO8859-1=ISO-8859-1
|
||||
locale.all.en_IE.ISO8859-15=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.en_IE.ISO8859-15@euro=ISO-8859-15
|
||||
locale.all.en_JP=EUC-JP
|
||||
locale.all.en_JP.IBM-eucJP=EUC-JP
|
||||
locale.all.En_JP.IBM-932=Shift_JIS
|
||||
locale.all.En_JP=Shift_JIS
|
||||
locale.all.en_KR=EUC-KR
|
||||
locale.all.en_KR.IBM-eucKR=EUC-KR
|
||||
locale.all.en_TH=ISO-8859-1
|
||||
locale.all.en_TW=x-euc-tw
|
||||
locale.all.en_TW.IBM-eucTW=x-euc-tw
|
||||
locale.all.en_US=ISO-8859-1
|
||||
locale.all.en_US.88591=ISO-8859-1
|
||||
locale.all.en_US.ISO8859-1=ISO-8859-1
|
||||
#FreeBSD
|
||||
locale.all.en_US.ISO_8859-1=ISO-8859-1
|
||||
locale.all.da_DK.ISO_8859-1=ISO-8859-1
|
||||
locale.all.de_AT.ISO_8859-1=ISO-8859-1
|
||||
locale.all.de_CH.ISO_8859-1=ISO-8859-1
|
||||
locale.all.de_DE.ISO_8859-1=ISO-8859-1
|
||||
locale.all.en_AU.ISO_8859-1=ISO-8859-1
|
||||
locale.all.en_CA.ISO_8859-1=ISO-8859-1
|
||||
locale.all.en_GB.ISO_8859-1=ISO-8859-1
|
||||
locale.all.es_ES.ISO_8859-1=ISO-8859-1
|
||||
locale.all.fi_FI.ISO_8859-1=ISO-8859-1
|
||||
locale.all.fr_BE.ISO_8859-1=ISO-8859-1
|
||||
locale.all.fr_CA.ISO_8859-1=ISO-8859-1
|
||||
locale.all.fr_CH.ISO_8859-1=ISO-8859-1
|
||||
locale.all.fr_FR.ISO_8859-1=ISO-8859-1
|
||||
locale.all.is_IS.ISO_8859-1=ISO-8859-1
|
||||
locale.all.it_CH.ISO_8859-1=ISO-8859-1
|
||||
locale.all.it_IT.ISO_8859-1=ISO-8859-1
|
||||
locale.all.la_LN.ISO_8859-1=ISO-8859-1
|
||||
locale.all.nl_BE.ISO_8859-1=ISO-8859-1
|
||||
locale.all.nl_NL.ISO_8859-1=ISO-8859-1
|
||||
locale.all.no_NO.ISO_8859-1=ISO-8859-1
|
||||
locale.all.pt_PT.ISO_8859-1=ISO-8859-1
|
||||
locale.all.sv_SE.ISO_8859-1=ISO-8859-1
|
||||
# FreeBSD 8859-15
|
||||
locale.all.da_DK.DIS_8859-15=ISO-8859-15
|
||||
locale.all.de_AT.DIS_8859-15=ISO-8859-15
|
||||
locale.all.de_CH.DIS_8859-15=ISO-8859-15
|
||||
locale.all.de_DE.DIS_8859-15=ISO-8859-15
|
||||
locale.all.en_AU.DIS_8859-15=ISO-8859-15
|
||||
locale.all.en_CA.DIS_8859-15=ISO-8859-15
|
||||
locale.all.en_GB.DIS_8859-15=ISO-8859-15
|
||||
locale.all.en_US.DIS_8859-15=ISO-8859-15
|
||||
locale.all.es_ES.DIS_8859-15=ISO-8859-15
|
||||
locale.all.fi_FI.DIS_8859-15=ISO-8859-15
|
||||
locale.all.fr_BE.DIS_8859-15=ISO-8859-15
|
||||
locale.all.fr_CA.DIS_8859-15=ISO-8859-15
|
||||
locale.all.fr_CH.DIS_8859-15=ISO-8859-15
|
||||
locale.all.fr_FR.DIS_8859-15=ISO-8859-15
|
||||
locale.all.is_IS.DIS_8859-15=ISO-8859-15
|
||||
locale.all.it_CH.DIS_8859-15=ISO-8859-15
|
||||
locale.all.it_IT.DIS_8859-15=ISO-8859-15
|
||||
locale.all.la_LN.DIS_8859-15=ISO-8859-15
|
||||
locale.all.nl_BE.DIS_8859-15=ISO-8859-15
|
||||
locale.all.nl_NL.DIS_8859-15=ISO-8859-15
|
||||
locale.all.no_NO.DIS_8859-15=ISO-8859-15
|
||||
locale.all.pt_PT.DIS_8859-15=ISO-8859-15
|
||||
locale.all.sv_SE.DIS_8859-15=ISO-8859-15
|
||||
# FreeBSD 8859-2
|
||||
locale.all.cs_CZ.ISO_8859-2=ISO-8859-2
|
||||
locale.all.hr_HR.ISO_8859-2=ISO-8859-2
|
||||
locale.all.hu_HU.ISO_8859-2=ISO-8859-2
|
||||
locale.all.la_LN.ISO_8859-2=ISO-8859-2
|
||||
locale.all.pl_PL.ISO_8859-2=ISO-8859-2
|
||||
locale.all.sl_SI.ISO_8859-2=ISO-8859-2
|
||||
# FreeBSD 8859-4
|
||||
locale.all.la_LN.ISO_8859-4=ISO-8859-4
|
||||
locale.all.lt_LT.ISO_8859-4=ISO-8859-4
|
||||
# FreeBSD 8859-5
|
||||
locale.all.ru_RU.ISO_8859-5=ISO-8859-5
|
||||
locale.all.ru_SU.ISO_8859-5=ISO-8859-5
|
||||
# FreeBSD Russian
|
||||
locale.all.ru_SU.KOI8-R=KOI8-R
|
||||
# FreeBSD Ukrainian
|
||||
locale.all.uk_UA.KOI8-U=KOI8-U
|
||||
# Solaris
|
||||
locale.all.en_US.UTF-8=UTF-8
|
||||
# Solaris
|
||||
locale.all.en_US.UTF-8@euro=UTF-8
|
||||
# AIX
|
||||
#locale.all.En_US=IBM-850
|
||||
locale.all.english.iso88591=ISO-8859-1
|
||||
locale.all.es=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.es.ISO8859-15=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.es.ISO8859-15@euro=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.es.UTF-8=UTF-8
|
||||
# Solaris
|
||||
locale.all.es.UTF-8@euro=UTF-8
|
||||
locale.all.es_ES=ISO-8859-1
|
||||
locale.all.es_ES.ISO8859-15=ISO-8859-15
|
||||
locale.all.es_ES.ISO8859-15@euro=ISO-8859-15
|
||||
locale.all.es_AR.ISO8859-1=ISO-8859-1
|
||||
locale.all.es_BO.ISO8859-1=ISO-8859-1
|
||||
locale.all.es_CL.ISO8859-1=ISO-8859-1
|
||||
locale.all.es_CO.ISO8859-1=ISO-8859-1
|
||||
locale.all.es_CR.ISO8859-1=ISO-8859-1
|
||||
locale.all.es_EC.ISO8859-1=ISO-8859-1
|
||||
locale.all.es_GT.ISO8859-1=ISO-8859-1
|
||||
locale.all.es_MX.ISO8859-1=ISO-8859-1
|
||||
locale.all.es_NI.ISO8859-1=ISO-8859-1
|
||||
locale.all.es_PA.ISO8859-1=ISO-8859-1
|
||||
locale.all.es_PE.ISO8859-1=ISO-8859-1
|
||||
locale.all.es_PY.ISO8859-1=ISO-8859-1
|
||||
locale.all.es_SV.ISO8859-1=ISO-8859-1
|
||||
locale.all.es_UY.ISO8859-1=ISO-8859-1
|
||||
locale.all.es_VE.ISO8859-1=ISO-8859-1
|
||||
# HP
|
||||
locale.all.es_ES.iso885915=ISO-8859-15
|
||||
# HP
|
||||
locale.all.es_ES.iso885915@euro=ISO-8859-15
|
||||
locale.all.es_ES.88591=ISO-8859-1
|
||||
locale.all.es_ES.ISO8859-1=ISO-8859-1
|
||||
# AIX
|
||||
#locale.all.En_ES=IBM-850
|
||||
# Solaris
|
||||
locale.all.et_EE.ISO8859-15=ISO-8859-15
|
||||
# AIX
|
||||
#locale.all.Et_ET=IBM-922
|
||||
# AIX
|
||||
locale.all.ET_ET=UTF-8
|
||||
locale.all.fi=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.fi.ISO8859-15=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.fi.ISO8859-15@euro=ISO-8859-15
|
||||
locale.all.fi_FI=ISO-8859-1
|
||||
locale.all.fi_FI.88591=ISO-8859-1
|
||||
locale.all.fi_FI.ISO8859-1=ISO-8859-1
|
||||
locale.all.fi_FI.ISO8859-15=ISO-8859-15
|
||||
locale.all.fi_FI.ISO8859-15@euro=ISO-8859-15
|
||||
# HP
|
||||
locale.all.fi_FI.iso885915@euro=ISO-8859-15
|
||||
# AIX
|
||||
#locale.all.Fi_ES=IBM-850
|
||||
locale.all.finnish.iso88591=ISO-8859-1
|
||||
locale.all.fr=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.fr.ISO8859-15=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.fr.ISO8859-15@euro=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.fr.UTF-8=UTF-8
|
||||
# Solaris
|
||||
locale.all.fr.UTF-8@euro=UTF-8
|
||||
locale.all.fr_BE=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.fr_BE.ISO8859-15=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.fr_BE.ISO8859-15@euro=ISO-8859-15
|
||||
locale.all.fr_BE.88591=ISO-8859-1
|
||||
locale.all.fr_BE.ISO8859-1=ISO-8859-1
|
||||
locale.all.fr_BE.iso8859=ISO-8859-1
|
||||
# AIX
|
||||
#locale.all.Fr_BE=IBM-850
|
||||
locale.all.fr_CA=ISO-8859-1
|
||||
locale.all.fr_CA.88591=ISO-8859-1
|
||||
locale.all.fr_CA.iso8859=ISO-8859-1
|
||||
# HP
|
||||
locale.all.fr_CA.iso885915@euro=ISO-8859-15
|
||||
locale.all.fr_CA.ISO8859-1=ISO-8859-1
|
||||
# AIX
|
||||
#locale.all.Fr_CA=IBM-850
|
||||
locale.all.fr_CH=ISO-8859-1
|
||||
locale.all.fr_CH.88591=ISO-8859-1
|
||||
locale.all.fr_CH.iso8859=ISO-8859-1
|
||||
locale.all.fr_CH.ISO8859-1=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.fr_FR.ISO8859-15=ISO-8859-15
|
||||
locale.all.fr_FR.ISO8859-15@euro=ISO-8859-15
|
||||
# AIX
|
||||
#locale.all.Fr_CH=IBM-850
|
||||
locale.all.fr_FR=ISO-8859-1
|
||||
locale.all.fr_FR.88591=ISO-8859-1
|
||||
locale.all.fr_FR.iso8859=ISO-8859-1
|
||||
# HP
|
||||
locale.all.fr_FR.iso885915=ISO-8859-15
|
||||
# HP
|
||||
locale.all.fr_FR.iso885915@euro=ISO-8859-15
|
||||
locale.all.fr_FR.ISO8859-1=ISO-8859-1
|
||||
# AIX
|
||||
#locale.all.Fr_FR=IBM-850
|
||||
locale.all.french.iso88591=ISO-8859-1
|
||||
locale.all.german.iso88591=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.he_HE=ISO-8859-8
|
||||
locale.all.he_IL=ISO-8859-8
|
||||
locale.all.hr_HR.ISO8859-2=ISO-8859-2
|
||||
# AIX
|
||||
locale.all.hr_HR=ISO-8859-2
|
||||
locale.all.hu_HU=ISO-8859-2
|
||||
locale.all.hu_HU.88592=ISO-8859-2
|
||||
locale.all.hu_HU.ISO8859-2=ISO-8859-2
|
||||
locale.all.hungarian=ISO-8859-2
|
||||
locale.all.icelandic.iso88591=ISO-8859-1
|
||||
locale.all.iso_8859_1=ISO-8859-1
|
||||
locale.all.is=ISO-8859-1
|
||||
locale.all.is_IS=ISO-8859-1
|
||||
locale.all.is_IS.88591=ISO-8859-1
|
||||
locale.all.is_IS.ISO8859-1=ISO-8859-1
|
||||
# HP
|
||||
locale.all.is_IS.iso885915@euro=ISO-8859-15
|
||||
# AIX
|
||||
#locale.all.Is_IS=IBM-850
|
||||
locale.all.it=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.it.ISO8859-15=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.it.ISO8859-15@euro=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.it.UTF-8=UTF-8
|
||||
# Solaris
|
||||
locale.all.it.UTF-8@euro=UTF-8
|
||||
locale.all.it_IT.ISO8859-15=ISO-8859-15
|
||||
locale.all.it_IT.ISO8859-15@euro=ISO-8859-15
|
||||
# AIX
|
||||
#locale.all.It_IT=IBM-850
|
||||
locale.all.italian.iso8859-1=ISO-8859-1
|
||||
locale.all.it_CH=ISO-8859-1
|
||||
locale.all.it_IT=ISO-8859-1
|
||||
locale.all.it_IT.88591=ISO-8859-1
|
||||
locale.all.it_IT.ISO8859-1=ISO-8859-1
|
||||
# HP
|
||||
locale.all.it_IT.iso885915=ISO-8859-15
|
||||
# HP
|
||||
locale.all.it_IT.iso885915@euro=ISO-8859-15
|
||||
# AIX
|
||||
locale.all.iw_IL=ISO-8859-8
|
||||
# AIX
|
||||
#locale.all.Iw_IL=IBM-856
|
||||
locale.all.ja=EUC-JP
|
||||
locale.all.Ja_JP.IBM-932=Shift_JIS
|
||||
locale.all.Ja_JP=Shift_JIS
|
||||
locale.all.japanese=EUC-JP
|
||||
locale.all.japanese.euc=EUC-JP
|
||||
locale.all.ja_JP=EUC-JP
|
||||
# Solaris
|
||||
locale.all.ja_JP.UTF-8=UTF-8
|
||||
# Solaris
|
||||
locale.all.ja_JP.UTF-8@euro=UTF-8
|
||||
locale.all.ja_JP.EUC=EUC-JP
|
||||
locale.all.ja_JP.eucJP=EUC-JP
|
||||
locale.all.ja_JP.SJIS=Shift_JIS
|
||||
locale.all.ja_JP.PCK=Shift_JIS
|
||||
locale.all.ja_JP.IBM-eucJP=EUC-JP
|
||||
locale.all.ja_JP.mscode=Shift_JIS
|
||||
locale.all.ja_JP.ujis=EUC-JP
|
||||
locale.all.katakana=Shift_JIS
|
||||
locale.all.ko=EUC-KR
|
||||
locale.all.ko_KR=EUC-KR
|
||||
# Solaris
|
||||
locale.all.ko_KR.UTF-8=UTF-8
|
||||
# Solaris
|
||||
locale.all.ko_KR.UTF-8@euro=UTF-8
|
||||
locale.all.ko_KR.euc=EUC-KR
|
||||
locale.all.ko_KR.euckr=EUC-KR
|
||||
locale.all.ko_KR.eucKR=EUC-KR
|
||||
locale.all.ko_KR.IBM-eucKR=EUC-KR
|
||||
locale.all.ko_KR.EUC=EUC-KR
|
||||
locale.all.ko.UTF-8=UTF-8
|
||||
locale.all.korean=EUC-KR
|
||||
# Solaris
|
||||
locale.all.lt_LT.ISO8859-13=ISO-8859-13
|
||||
# AIX
|
||||
#locale.all.Lt_LT=IBM-921
|
||||
# AIX
|
||||
locale.all.LT_LT=UTF-8
|
||||
# Solaris
|
||||
locale.all.lv_LV.ISO8859-13=ISO-8859-13
|
||||
# AIX
|
||||
#locale.all.Lt_LV=IBM-921
|
||||
# AIX
|
||||
locale.all.LT_LV=UTF-8
|
||||
# Solaris
|
||||
locale.all.mk_MK.ISO8859-5=ISO-8859-5
|
||||
# AIX
|
||||
locale.all.mk_MK=ISO-8859-5
|
||||
locale.all.nl=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.nl.ISO8859-15=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.nl.ISO8859-15@euro=ISO-8859-15
|
||||
locale.all.nl_BE=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.nl_BE.ISO8859-15=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.nl_BE.ISO8859-15@euro=ISO-8859-15
|
||||
locale.all.nl_BE.88591=ISO-8859-1
|
||||
locale.all.nl_BE.ISO8859-1=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.nl_NL.ISO8859-15=ISO-8859-15
|
||||
locale.all.nl_NL.ISO8859-15@euro=ISO-8859-15
|
||||
# AIX
|
||||
#locale.all.NL_BE=IBM-850
|
||||
locale.all.nl_NL=ISO-8859-1
|
||||
locale.all.nl_NL.88591=ISO-8859-1
|
||||
locale.all.nl_NL.ISO8859-1=ISO-8859-1
|
||||
# HP
|
||||
locale.all.nl_NL.iso885915@euro=ISO-8859-15
|
||||
# AIX
|
||||
#locale.all.NL_NL=IBM-850
|
||||
locale.all.no=ISO-8859-1
|
||||
locale.all.no_NO=ISO-8859-1
|
||||
locale.all.no_NO.88591=ISO-8859-1
|
||||
locale.all.no_NO.ISO8859-1=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.no_NO.ISO8859-1@bokmal=ISO-8859-1
|
||||
locale.all.no_NO.ISO8859-1@nynorsk=ISO-8859-1
|
||||
# HP
|
||||
locale.all.no_NO.iso885915@euro=ISO-8859-15
|
||||
# AIX
|
||||
#locale.all.No_NO=IBM-850
|
||||
locale.all.norwegian.iso88591=ISO-8859-1
|
||||
locale.all.pl=ISO-8859-2
|
||||
locale.all.pl_PL=ISO-8859-2
|
||||
locale.all.pl_PL.88592=ISO-8859-2
|
||||
locale.all.pl_PL.ISO8859-2=ISO-8859-2
|
||||
locale.all.polish=ISO-8859-2
|
||||
locale.all.portuguese.iso88591=ISO-8859-1
|
||||
locale.all.pt=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.pt.ISO8859-15=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.pt.ISO8859-15@euro=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.pt_BR.ISO8859-1=ISO-8859-1
|
||||
locale.all.pt_PT.ISO8859-15=ISO-8859-15
|
||||
locale.all.pt_PT.ISO8859-15@euro=ISO-8859-15
|
||||
# AIX
|
||||
#locale.all.Pt.PT=IBM-850
|
||||
locale.all.pt_PT=ISO-8859-1
|
||||
locale.all.pt_PT.88591=ISO-8859-1
|
||||
# HP
|
||||
locale.all.pt_PT.iso885915@euro=ISO-8859-15
|
||||
locale.all.pt_PT.ISO8859-1=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.ro_RO.ISO8859-2=ISO-8859-2
|
||||
# AIX
|
||||
locale.all.ro_RO=ISO-8859-5
|
||||
# Solaris
|
||||
#locale.all.ru_RU.ANSI1251= ??? ANSI-1251 ???
|
||||
locale.all.ru_RU.ISO8859-5=ISO-8859-5
|
||||
# AIX
|
||||
locale.all.ru_RU=ISO-8859-5
|
||||
locale.all.ru_RU.KOI8-R=KOI8-R
|
||||
# RedHat 7 reported by Garaschenko Slava <slava@maze.ambernet.kiev.ua bug 70601
|
||||
locale.all.ru_RU.koi8r=KOI8-R
|
||||
# RedHat 7 reported by Garaschenko Slava <slava@maze.ambernet.kiev.ua bug 70601
|
||||
locale.all.ru_UA=KOI8-U
|
||||
locale.all.rumanian=ISO-8859-2
|
||||
locale.all.serbocroatian=ISO-8859-2
|
||||
locale.all.sh=ISO-8859-2
|
||||
# Solaris
|
||||
locale.all.sh_BA.ISO8859-2@bosnia=ISO-8859-2
|
||||
locale.all.sl_SI.ISO8859-2=ISO-8859-2
|
||||
locale.all.sq_AL.ISO8859-2=ISO-8859-2
|
||||
# AIX
|
||||
locale.all.sh_SP=ISO-8859-2
|
||||
locale.all.sk=ISO-8859-2
|
||||
locale.all.sk_SK=ISO-8859-2
|
||||
locale.all.sk_SK.88592=ISO-8859-2
|
||||
locale.all.sk_SK.ISO8859-2=ISO-8859-2
|
||||
locale.all.slovene=ISO-8859-2
|
||||
locale.all.spanish.iso88591=ISO-8859-1
|
||||
# AIX
|
||||
locale.all.sq_AL=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.sr_YU.ISO8859-5=ISO-8859-5
|
||||
# AIX
|
||||
locale.all.sr_SP=ISO-8859-5
|
||||
locale.all.sv=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.sv.ISO8859-15=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.sv.ISO8859-15@euro=ISO-8859-15
|
||||
# Solaris
|
||||
locale.all.sv.UTF-8=UTF-8
|
||||
# Solaris
|
||||
locale.all.sv.UTF-8@euro=UTF-8
|
||||
locale.all.sv_SE=ISO-8859-1
|
||||
locale.all.sv_SE.88591=ISO-8859-1
|
||||
locale.all.sv_SE.ISO8859-15=ISO-8859-15
|
||||
locale.all.sv_SE.ISO8859-15@euro=ISO-8859-15
|
||||
# HP
|
||||
locale.all.sv_SE.iso885915=ISO-8859-15
|
||||
# HP
|
||||
locale.all.sv_SE.iso885915@euro=ISO-8859-15
|
||||
locale.all.sv_SE.ISO8859-1=ISO-8859-1
|
||||
locale.all.Sv_SE=IBM-850
|
||||
# AIX
|
||||
locale.all.swedish.iso88591=ISO-8859-1
|
||||
# Solaris
|
||||
locale.all.tr_TR.ISO8859-9=ISO-8859-9
|
||||
# AIX
|
||||
locale.all.tr_TR=ISO-8859-9
|
||||
# Solaris
|
||||
locale.all.th_TH=TIS-620
|
||||
locale.all.th_TH.TIS620=TIS-620
|
||||
locale.all.th=TIS-620
|
||||
locale.all.th_TH.UTF-8=UTF-8
|
||||
locale.all.tchinese=x-euc-tw
|
||||
# RedHat 7 reported by Garaschenko Slava <slava@maze.ambernet.kiev.ua bug 70601
|
||||
locale.all.uk_UA=KOI8-U
|
||||
locale.all.zh=GB2312
|
||||
locale.all.zh_CN=GB2312
|
||||
locale.all.zh_CN.EUC=GB2312
|
||||
locale.all.zh.GBK=x-gbk
|
||||
locale.all.zh_CN.UTF-8=UTF-8
|
||||
locale.all.zh.UTF-8=UTF-8
|
||||
locale.all.zh_TW.EUC=x-euc-tw
|
||||
locale.all.zh_TW.BIG5=Big5
|
||||
locale.all.zh_HK.HKSCS=x-hkscs
|
||||
# saw the following name from news://xcin.linux.org.tw/tlug.cle-devel
|
||||
locale.all.zh_CN.GB2312=GB2312
|
||||
# AIX
|
||||
locale.all.ZH_CN=UTF-8
|
||||
locale.all.zh_CN.ugb=GB2312
|
||||
locale.all.zh_CN.GBK=x-gbk
|
||||
locale.all.zh_HK.big5=Big5
|
||||
locale.all.zh_HK.eucTW=x-euc-tw
|
||||
locale.all.zh_TW=x-euc-tw
|
||||
locale.all.zh_TW.IBM-eucTW=x-euc-tw
|
||||
locale.all.zh_TW.eucTW=x-euc-tw
|
||||
locale.all.zh_TW.eucTW@chuyin=x-euc-tw
|
||||
locale.all.zh_TW.eucTW@radical=x-euc-tw
|
||||
locale.all.zh_TW.eucTW@stroke=x-euc-tw
|
||||
locale.all.zh_TW.big5=Big5
|
||||
locale.all.zh_TW.big5@chuyin=Big5
|
||||
locale.all.zh_TW.big5@radical=Big5
|
||||
locale.all.zh_TW.big5@stroke=Big5
|
||||
locale.all.zh_TW.ucns=x-euc-tw
|
||||
# AIX
|
||||
locale.all.Zh_TW.big5=Big5
|
||||
# CLE 0.8
|
||||
locale.all.zh_TW.Big5=Big5
|
||||
# SunOS 5.7 according to pofeng@linux.org.tw (already above)
|
||||
# locale.all.zh_TW.BIG5=Big5
|
||||
# OpenVMS
|
||||
locale.all.ja_JP.sdeckanji=EUC-JP
|
||||
@@ -1,67 +0,0 @@
|
||||
##
|
||||
##
|
||||
## 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) 1999 Netscape Communications Corporation. All
|
||||
## Rights Reserved.
|
||||
##
|
||||
## Contributor(s):
|
||||
##
|
||||
## This file (unixcharset.sample.properties) is a sample file for
|
||||
## mapping between nl_langinfo(CODESET) and the charset name aliases
|
||||
## that Mozilla uses. For Linux ($OSARCH=Linux) the file name would be
|
||||
## unixcharset.Linux.properties
|
||||
## These mappings are only needed if a nl_langinfo(CODESET)
|
||||
## return value is in conflict with the Mozilla charset name
|
||||
## aliases.
|
||||
##
|
||||
## The left hand side specifies a nl_langinfo(CODESET) return
|
||||
## value to remap to right hand side Mozilla charset name alias.
|
||||
##
|
||||
## There are 2 ways to specify a mapping:
|
||||
##
|
||||
## 1) generic (all glib versions)
|
||||
## 2) GLIBC version specific
|
||||
##
|
||||
## The generic form is:
|
||||
##
|
||||
## nllic.$NLLIC_CODESET=$MOZ_CODESET
|
||||
##
|
||||
## eg:
|
||||
##
|
||||
## nllic.KOI8=KOI8-R
|
||||
##
|
||||
## The GLIBC specific form is:
|
||||
##
|
||||
## nllic.$GLIBC.$NLLIC_CODESET=$MOZ_CODESET
|
||||
##
|
||||
## (nllic = nl_langinfo(CODESET))
|
||||
## ( nl l i c )
|
||||
##
|
||||
## eg: for a glibc version 2.1.3:
|
||||
##
|
||||
## nllic.2.1.3.KOI8=KOI8-R
|
||||
##
|
||||
## If different glibc versions of nl_langinfo(CODESET) need
|
||||
## different remappings these may coexist in this file as needed.
|
||||
##
|
||||
## (To determine a system's glibc version use: glib-config --version)
|
||||
##
|
||||
##
|
||||
## Note:
|
||||
## At present this is a sample file.
|
||||
## The nl_langinfo(CODESET) return values on Linux can be used
|
||||
## directly and thus this file is not needed.
|
||||
##
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,172 +0,0 @@
|
||||
_uHitFormate0 ; 9665
|
||||
_uMapCode ; 7105
|
||||
_uMapFormate0 ; 6593
|
||||
?AddRef@nsUnicodeDecodeHelper@@UAGKXZ ; 4303
|
||||
_uScan ; 4096
|
||||
_uCheckAndScanAlways1Byte ; 4096
|
||||
_uGenerate ; 3009
|
||||
_uCheckAndGenAlways1Byte ; 3009
|
||||
?Release@nsBasicDecoderSupport@@UAGKXZ ; 2970
|
||||
?AddRef@nsCharsetConverterManager@@UAGKXZ ; 1724
|
||||
?QueryInterface@nsCharsetConverterManager@@UAGIABUnsID@@PAPAX@Z ; 1723
|
||||
?Release@nsCharsetConverterManager@@UAGKXZ ; 1721
|
||||
?GetUnicodeDecoder@nsCharsetConverterManager@@UAGIPBVnsString@@PAPAVnsIUnicodeDecoder@@@Z ; 1667
|
||||
?QueryInterface@nsBasicDecoderSupport@@UAGIABUnsID@@PAPAX@Z ; 1426
|
||||
?Convert@nsOneByteDecoderSupport@@MAGIPBDPAHPAG1@Z ; 1375
|
||||
?ConvertByFastTable@nsUnicodeDecodeHelper@@UAGIPBDPAHPAG12H@Z ; 1375
|
||||
?GetMaxLength@nsMacRomanToUnicode@@MAGIPBDHPAH@Z ; 1362
|
||||
?Release@nsUnicodeEncodeHelper@@UAGKXZ ; 1288
|
||||
?GetPreferred@nsCharsetAlias2@@UAGIABVnsString@@AAV2@@Z ; 1280
|
||||
?Get@nsURLProperties@@UAGIABVnsString@@AAV2@@Z ; 1260
|
||||
?QueryInterface@nsCharsetAlias2@@UAGIABUnsID@@PAPAX@Z ; 1229
|
||||
?do_GetService@@YA?BVnsGetServiceByContractID@@PBDPAI@Z ; 1189
|
||||
?Convert@nsUTF8ToUnicode@@MAGIPBDPAHPAG1@Z ; 793
|
||||
?Reset@nsOneByteDecoderSupport@@MAGIXZ ; 761
|
||||
?GetCharsetAtom@nsCharsetConverterManager@@UAGIPBGPAPAVnsIAtom@@@Z ; 748
|
||||
?GetMaxLength@nsUTF8ToUnicode@@MAGIPBDHPAH@Z ; 578
|
||||
_uMapFormate1 ; 512
|
||||
?QueryInterface@nsCharsetMenu@@UAGIABUnsID@@PAPAX@Z ; 495
|
||||
?AddRef@nsCharsetMenu@@UAGKXZ ; 493
|
||||
?Equals@nsCharsetAlias2@@UAGIABVnsString@@0PAH@Z ; 440
|
||||
?GetBundleValue@nsCharsetConverterManager@@AAEIPAVnsIStringBundle@@PBVnsIAtom@@PAVnsString@@PAPAG@Z ; 385
|
||||
?Release@nsCharsetMenu@@UAGKXZ ; 382
|
||||
?FlushBuffer@nsEncoderSupport@@IAEIPAPADPBD@Z ; 372
|
||||
?ConvertNoBuffNoErr@nsTableEncoderSupport@@MAGIPBGPAHPAD1@Z ; 288
|
||||
?ConvertByTable@nsUnicodeEncodeHelper@@UAGIPBGPAHPAD1PAUuShiftTable@@PAPAG@Z ; 288
|
||||
?Convert@nsEncoderSupport@@UAGIPBGPAHPAD1@Z ; 288
|
||||
?ConvertNoBuff@nsEncoderSupport@@MAGIPBGPAHPAD1@Z ; 288
|
||||
?GetMaxLength@nsUnicodeToISO88591@@MAGIPBGHPAH@Z ; 286
|
||||
??0nsBasicDecoderSupport@@QAE@XZ ; 239
|
||||
??1nsBasicDecoderSupport@@UAE@XZ ; 236
|
||||
?Reset@nsUTF8ToUnicode@@MAGIXZ ; 232
|
||||
??0nsUTF8ToUnicode@@QAE@XZ ; 223
|
||||
?NS_NewUTF8ToUnicode@@YGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 223
|
||||
??_EnsBasicDecoderSupport@@UAEPAXI@Z ; 220
|
||||
?assign_assuming_AddRef@nsCOMPtr_base@@IAEXPAVnsISupports@@@Z ; 192
|
||||
?Assert@nsCharsetMenu@@UAGIPAVnsIRDFResource@@0PAVnsIRDFNode@@H@Z ; 183
|
||||
?AddMenuItemToContainer@nsCharsetMenu@@AAEIPAVnsIRDFContainer@@PAVnsMenuEntry@@PAVnsIRDFResource@@PADH@Z ; 171
|
||||
?AddCharsetToItemArray@nsCharsetMenu@@AAEIPAVnsVoidArray@@PAVnsIAtom@@PAPAVnsMenuEntry@@H@Z ; 168
|
||||
?GetCharsetTitle2@nsCharsetConverterManager@@UAGIPBVnsIAtom@@PAVnsString@@@Z ; 168
|
||||
?GetCharsetTitle@nsCharsetConverterManager@@UAGIPBVnsIAtom@@PAPAG@Z ; 168
|
||||
?GetBundleValue@nsCharsetConverterManager@@AAEIPAVnsIStringBundle@@PBVnsIAtom@@PAVnsString@@PAPAV3@@Z ; 116
|
||||
?GetCharsetLangGroup@nsCharsetConverterManager@@UAGIPBVnsIAtom@@PAPAV2@@Z ; 116
|
||||
?GetCharsetData2@nsCharsetConverterManager@@UAGIPBVnsIAtom@@PBGPAVnsString@@@Z ; 101
|
||||
?GetCharsetData@nsCharsetConverterManager@@UAGIPBVnsIAtom@@PBGPAPAG@Z ; 101
|
||||
?Release@nsBasicEncoder@@UAGKXZ ; 86
|
||||
?AddCharsetToContainer@nsCharsetMenu@@AAEIPAVnsVoidArray@@PAVnsIRDFContainer@@PAVnsIAtom@@PADHH@Z ; 82
|
||||
?GetCharsetAtom2@nsCharsetConverterManager@@UAGIPBDPAPAVnsIAtom@@@Z ; 82
|
||||
?WriteCacheToPrefs@nsCharsetMenu@@AAEIPAVnsVoidArray@@HPBD@Z ; 76
|
||||
?AddCharsetToCache@nsCharsetMenu@@AAEIPAVnsIAtom@@PAVnsVoidArray@@PAVnsIRDFResource@@HHH@Z ; 76
|
||||
?FindMenuItemInArray@nsCharsetMenu@@AAEHPAVnsVoidArray@@PAVnsIAtom@@PAPAVnsMenuEntry@@@Z ; 76
|
||||
?SetCurrentCharset@nsCharsetMenu@@UAGIPBG@Z ; 75
|
||||
?Reset@nsEncoderSupport@@UAGIXZ ; 70
|
||||
??0nsTableEncoderSupport@@QAE@PAUuShiftTable@@PAPAG@Z ; 43
|
||||
?NS_NewUnicodeEncodeHelper@@YGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 43
|
||||
?QueryInterface@nsBasicEncoder@@UAGIABUnsID@@PAPAX@Z ; 43
|
||||
?QueryInterface@nsUnicodeEncodeHelper@@UAGIABUnsID@@PAPAX@Z ; 43
|
||||
?GetUnicodeEncoder@nsCharsetConverterManager@@UAGIPBVnsString@@PAPAVnsIUnicodeEncoder@@@Z ; 43
|
||||
??1nsBasicEncoder@@UAE@XZ ; 43
|
||||
??0nsBasicEncoder@@QAE@XZ ; 43
|
||||
??_EnsUnicodeEncodeHelper@@UAEPAXI@Z ; 43
|
||||
??_GnsUnicodeToCP1252@@UAEPAXI@Z ; 43
|
||||
??1nsEncoderSupport@@UAE@XZ ; 43
|
||||
??1nsUnicodeEncodeHelper@@UAE@XZ ; 43
|
||||
??1nsTableEncoderSupport@@UAE@XZ ; 43
|
||||
??0nsEncoderSupport@@QAE@XZ ; 43
|
||||
??0nsUnicodeEncodeHelper@@QAE@XZ ; 43
|
||||
?Finish@nsEncoderSupport@@UAGIPADPAH@Z ; 42
|
||||
?FinishNoBuff@nsEncoderSupport@@MAGIPADPAH@Z ; 42
|
||||
?AddObserver@nsCharsetMenu@@UAGIPAVnsIRDFObserver@@@Z ; 33
|
||||
?NS_NewUnicodeToISO88591@@YGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 29
|
||||
??0nsUnicodeToISO88591@@QAE@XZ ; 29
|
||||
?NewRDFContainer@nsCharsetMenu@@AAEIPAVnsIRDFDataSource@@PAVnsIRDFResource@@PAPAVnsIRDFContainer@@@Z ; 18
|
||||
?SetOutputErrorBehavior@nsEncoderSupport@@UAGIHPAVnsIUnicharEncoder@@G@Z ; 17
|
||||
??1nsUnicodeDecodeHelper@@UAE@XZ ; 16
|
||||
??_GnsUnicodeDecodeHelper@@UAEPAXI@Z ; 16
|
||||
?ConvertByTable@nsUnicodeDecodeHelper@@UAGIPBDPAHPAG1PAUuShiftTable@@PAPAG@Z ; 16
|
||||
??_GnsCP1252ToUnicode@@UAEPAXI@Z ; 16
|
||||
??1nsOneByteDecoderSupport@@UAE@XZ ; 16
|
||||
?CreateFastTable@nsUnicodeDecodeHelper@@UAGIPAUuShiftTable@@PAPAGPAGH@Z ; 16
|
||||
?QueryInterface@nsUnicodeDecodeHelper@@UAGIABUnsID@@PAPAX@Z ; 16
|
||||
?NS_NewUnicodeDecodeHelper@@YGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 16
|
||||
??0nsOneByteDecoderSupport@@QAE@PAUuShiftTable@@PAPAG@Z ; 16
|
||||
??0nsUnicodeDecodeHelper@@QAE@XZ ; 16
|
||||
?NS_NewCP1252ToUnicode@@YGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 15
|
||||
??0nsCP1252ToUnicode@@QAE@XZ ; 15
|
||||
?Release@nsUConvModule@@UAGKXZ ; 14
|
||||
?NS_NewUnicodeToCP1252@@YGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 14
|
||||
??0nsUnicodeToCP1252@@QAE@XZ ; 14
|
||||
?Release@nsWinCharset@@UAGKXZ ; 13
|
||||
?AddFromStringToMenu@nsCharsetMenu@@AAEIPADPAVnsVoidArray@@PAVnsIRDFContainer@@PAVnsISupportsArray@@0@Z ; 12
|
||||
?GetClassObject@nsUConvModule@@UAGIPAVnsIComponentManager@@ABUnsID@@1PAPAX@Z ; 12
|
||||
?QueryInterface@nsCharsetMenuObserver@@UAGIABUnsID@@PAPAX@Z ; 10
|
||||
?Release@nsCharsetMenuObserver@@UAGKXZ ; 10
|
||||
?AddFromPrefsToMenu@nsCharsetMenu@@AAEIPAVnsVoidArray@@PAVnsIRDFContainer@@PBDPAVnsISupportsArray@@PAD@Z ; 9
|
||||
?RemoveObserver@nsCharsetMenu@@UAGIPAVnsIRDFObserver@@@Z ; 8
|
||||
?QueryInterface@nsWinCharset@@UAGIABUnsID@@PAPAX@Z ; 8
|
||||
?GetRegistryEnumeration2@nsCharsetConverterManager@@AAEIPADHPAPAVnsISupportsArray@@@Z ; 6
|
||||
?GetDecoderList@nsCharsetConverterManager@@UAGIPAPAVnsISupportsArray@@@Z ; 5
|
||||
?GetCharset@nsWinCharset@@UAGIW4nsPlatformCharsetSel@@AAVnsString@@@Z ; 4
|
||||
?GetDefaultCharsetForLocale@nsWinCharset@@UAGIPBGPAPAG@Z ; 4
|
||||
?AddCharsetArrayToItemArray@nsCharsetMenu@@AAEIPAVnsVoidArray@@PAVnsISupportsArray@@@Z ; 3
|
||||
?GetCollation@nsCharsetMenu@@AAEIPAPAVnsICollation@@@Z ; 3
|
||||
?ConvertAndEscape@nsTextToSubURI@@UAGIPBDPBGPAPAD@Z ; 3
|
||||
?AddMenuItemArrayToContainer@nsCharsetMenu@@AAEIPAVnsIRDFContainer@@PAVnsVoidArray@@PAVnsIRDFResource@@@Z ; 3
|
||||
?do_GetService@@YA?BVnsGetServiceByCID@@ABUnsID@@PAI@Z ; 3
|
||||
?AddSeparatorToContainer@nsCharsetMenu@@AAEIPAVnsIRDFContainer@@@Z ; 3
|
||||
?InitCacheMenu@nsCharsetMenu@@AAEIPAVnsISupportsArray@@PAVnsIRDFResource@@PBDPAVnsVoidArray@@@Z ; 3
|
||||
?AddFromNolocPrefsToMenu@nsCharsetMenu@@AAEIPAVnsVoidArray@@PAVnsIRDFContainer@@PBDPAVnsISupportsArray@@PAD@Z ; 3
|
||||
?InitStaticMenu@nsCharsetMenu@@AAEIPAVnsISupportsArray@@PAVnsIRDFResource@@PBDPAVnsVoidArray@@@Z ; 3
|
||||
?QueryInterface@nsTextToSubURI@@UAGIABUnsID@@PAPAX@Z ; 3
|
||||
?FreeMenuItemArray@nsCharsetMenu@@AAEXPAVnsVoidArray@@@Z ; 3
|
||||
?ReorderMenuItemArray@nsCharsetMenu@@AAEIPAVnsVoidArray@@@Z ; 3
|
||||
?UnEscapeAndConvert@nsTextToSubURI@@UAGIPBD0PAPAG@Z ; 3
|
||||
?NS_OpenURI@@YAIPAPAVnsIChannel@@PAVnsIURI@@PAVnsIIOService@@PAVnsILoadGroup@@PAVnsIInterfaceRequestor@@I@Z ; 2
|
||||
?RemoveFlaggedCharsets@nsCharsetMenu@@AAEIPAVnsISupportsArray@@PAVnsString@@@Z ; 2
|
||||
??0nsURLProperties@@QAE@AAVnsString@@@Z ; 2
|
||||
?InitMoreMenu@nsCharsetMenu@@AAEIPAVnsISupportsArray@@PAVnsIRDFResource@@PAD@Z ; 2
|
||||
?NS_OpenURI@@YAIPAPAVnsIInputStream@@PAVnsIURI@@PAVnsIIOService@@PAVnsILoadGroup@@PAVnsIInterfaceRequestor@@I@Z ; 2
|
||||
?LoadExtensibleBundle@nsCharsetConverterManager@@AAEIPBDPAPAVnsIStringBundle@@@Z ; 2
|
||||
?CanUnload@nsUConvModule@@UAGIPAVnsIComponentManager@@PAH@Z ; 1
|
||||
?GetCharsetLangGroup@nsCharsetConverterManager@@UAGIPAVnsString@@PAPAVnsIAtom@@@Z ; 1
|
||||
?InitOthers@nsCharsetMenu@@AAEIXZ ; 1
|
||||
?GetURI@nsCharsetMenu@@UAGIPAPAD@Z ; 1
|
||||
?InitComposerMenu@nsCharsetMenu@@AAEIXZ ; 1
|
||||
?GetRegistryEnumeration@nsCharsetConverterManager@@AAEIPAD0PAPAVnsISupportsArray@@@Z ; 1
|
||||
??0nsCharsetConverterManager@@QAE@XZ ; 1
|
||||
?NS_NewCharsetMenu@@YGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 1
|
||||
?InitSecodaryTiers@nsCharsetMenu@@AAEIXZ ; 1
|
||||
??0nsISO88591ToUnicode@@QAE@XZ ; 1
|
||||
??_EnsWinCharset@@UAEPAXI@Z ; 1
|
||||
??0nsUConvModule@@QAE@XZ ; 1
|
||||
?InitMaileditMenu@nsCharsetMenu@@AAEIXZ ; 1
|
||||
?GetCharsetDetectorList@nsCharsetConverterManager@@UAGIPAPAVnsISupportsArray@@@Z ; 1
|
||||
??0nsWinCharset@@QAE@XZ ; 1
|
||||
??0nsTextToSubURI@@QAE@XZ ; 1
|
||||
??_GnsTextToSubURI@@UAEPAXI@Z ; 1
|
||||
?InitMoreSubmenus@nsCharsetMenu@@AAEIPAVnsISupportsArray@@@Z ; 1
|
||||
??1nsURLProperties@@UAE@XZ ; 1
|
||||
?NS_NewCharsetAlias@@YGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 1
|
||||
?QueryInterface@nsUConvModule@@UAGIABUnsID@@PAPAX@Z ; 1
|
||||
_NSGetModule ; 1
|
||||
??_EnsURLProperties@@UAEPAXI@Z ; 1
|
||||
?NS_NewPlatformCharset@@YGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 1
|
||||
?InitResources@nsCharsetMenu@@AAEIXZ ; 1
|
||||
?InitAutodetMenu@nsCharsetMenu@@AAEIPAVnsIRDFResource@@@Z ; 1
|
||||
?GetUnicodeDecoder@nsCharsetConverterManager@@UAGIPBVnsIAtom@@PAPAVnsIUnicodeDecoder@@@Z ; 1
|
||||
?SetCurrentMailCharset@nsCharsetMenu@@UAGIPBG@Z ; 1
|
||||
??_GnsUConvModule@@UAEPAXI@Z ; 1
|
||||
?InitMailviewMenu@nsCharsetMenu@@AAEIXZ ; 1
|
||||
?NS_NewISO88591ToUnicode@@YGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 1
|
||||
?NS_NewCharsetConverterManager@@YGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 1
|
||||
??0nsCharsetMenu@@QAE@XZ ; 1
|
||||
?GetEncoderList@nsCharsetConverterManager@@UAGIPAPAVnsISupportsArray@@@Z ; 1
|
||||
?NS_NewTextToSubURI@@YGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 1
|
||||
??1nsTextToSubURI@@UAE@XZ ; 1
|
||||
?InitBrowserMenu@nsCharsetMenu@@AAEIXZ ; 1
|
||||
?Init@nsCharsetMenu@@AAEIXZ ; 1
|
||||
??1nsUConvModule@@UAE@XZ ; 1
|
||||
??1nsWinCharset@@UAE@XZ ; 1
|
||||
?Shutdown@nsUConvModule@@IAEXXZ ; 1
|
||||
_uCheckAndScanJohabHangul ; 1
|
||||
??0nsCharsetAlias2@@QAE@XZ ; 1
|
||||
@@ -1,38 +0,0 @@
|
||||
##
|
||||
## 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) 1999 Netscape Communications Corporation. All
|
||||
## Rights Reserved.
|
||||
##
|
||||
## Contributor(s):
|
||||
##
|
||||
## This file map a ACP to a charset name
|
||||
## We use this to figure out the charset of file system, clipboard, etc
|
||||
##
|
||||
acp.874=TIS-620
|
||||
acp.932=Shift_JIS
|
||||
acp.936=gb18030
|
||||
acp.949=x-windows-949
|
||||
acp.950=Big5
|
||||
acp.951=Big5-HKSCS
|
||||
acp.1250=windows-1250
|
||||
acp.1251=windows-1251
|
||||
acp.1252=windows-1252
|
||||
acp.1253=windows-1253
|
||||
acp.1254=windows-1254
|
||||
acp.1255=windows-1255
|
||||
acp.1256=windows-1256
|
||||
acp.1257=windows-1257
|
||||
acp.1258=windows-1258
|
||||
@@ -1,70 +0,0 @@
|
||||
#
|
||||
# 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):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
REQUIRES = \
|
||||
string \
|
||||
xpcom \
|
||||
uconv \
|
||||
locale \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
TestUConv.cpp \
|
||||
nsconv.cpp \
|
||||
plattest.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
CPPSRCS += convperf.cpp
|
||||
endif
|
||||
|
||||
SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -DUSE_NSREG
|
||||
|
||||
INCLUDES += \
|
||||
-I$(srcdir)/../ucvlatin \
|
||||
-I$(srcdir)/../ucvja \
|
||||
-I$(srcdir)/../util \
|
||||
$(NULL)
|
||||
|
||||
LIBS += \
|
||||
$(LIBS_DIR) \
|
||||
$(XPCOM_LIBS) \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
# needed for mac linux
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
ifneq ($(OS_RELEASE),1.2)
|
||||
OS_LIBS += /usr/lib/libdl.so
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -1,642 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsICharsetConverterManager2.h"
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsString.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
#define ARRAY_SIZE(_array) (sizeof(_array) / sizeof(_array[0]))
|
||||
#define SMALL_BUFFER_SIZE 512
|
||||
#define MED_BUFFER_SIZE 1024
|
||||
#define BIG_BUFFER_SIZE 2048
|
||||
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Class nsTestLog [declaration]
|
||||
|
||||
/**
|
||||
* A Logging class for test programs.
|
||||
*
|
||||
* This simple test program will not trigger a component registration. So
|
||||
* Mozilla has to be run once before running this, so that the necessary
|
||||
* components will be registered. Also, please observe that the ContractID's are
|
||||
* case sensitive now!
|
||||
*
|
||||
* @created 28/Mar/2000
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsTestLog
|
||||
{
|
||||
private:
|
||||
|
||||
static const char * kTraceDelimiter;
|
||||
|
||||
nsCAutoString mTrace;
|
||||
|
||||
public:
|
||||
|
||||
void AddTrace(char * aTrace);
|
||||
void DelTrace(char * aTrace);
|
||||
void PrintError(char * aCall, int aError);
|
||||
void PrintError(char * aCall, char * aMessage);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Class nsTestUConv [declaration]
|
||||
|
||||
/**
|
||||
* The main class of the program.
|
||||
*
|
||||
* XXX Create a very general set of "bug and regression" test cases and the
|
||||
* one in TestTempBug()
|
||||
* XXX Apply the new argument style (pointers) to the converters interfaces
|
||||
*
|
||||
* @created 28/Mar/2000
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsTestUConv
|
||||
{
|
||||
private:
|
||||
|
||||
nsTestLog mLog;
|
||||
|
||||
/**
|
||||
* Run the built-in set of self tests for encoders.
|
||||
*/
|
||||
nsresult TestEncoders();
|
||||
|
||||
/**
|
||||
* Run the built-in set of self tests for decoders.
|
||||
*/
|
||||
nsresult TestDecoders();
|
||||
|
||||
/**
|
||||
* Run the built-in set of self tests for the CharsetManager.
|
||||
*/
|
||||
nsresult TestCharsetManager();
|
||||
|
||||
/**
|
||||
* Display charset detectors and their attributes.
|
||||
*/
|
||||
nsresult DisplayDetectors();
|
||||
|
||||
/**
|
||||
* Display charsets and their attributes.
|
||||
*/
|
||||
nsresult DisplayCharsets();
|
||||
|
||||
/**
|
||||
* Run a temporary debug test. This method is ment as a placeholder when some
|
||||
* quick debugging is needed.
|
||||
*/
|
||||
nsresult TestTempBug();
|
||||
|
||||
nsresult Encode(PRUnichar ** aSrc, PRUnichar * aSrcEnd, char ** aDest,
|
||||
char * aDestEnd, nsString * aCharset);
|
||||
|
||||
/**
|
||||
* Bridge methods between the new argument style (poiters) and the old one
|
||||
* (lengths). To be removed when the converter interfaces will switch to the
|
||||
* new style.
|
||||
*
|
||||
* This wraps an encoder Convert() call.
|
||||
*/
|
||||
nsresult ConvertEncode(PRUnichar ** aSrc, PRUnichar * aSrcEnd, char ** aDest,
|
||||
char * aDestEnd, nsIUnicodeEncoder * aEncoder);
|
||||
|
||||
/**
|
||||
* This wraps an encoder Finish() call.
|
||||
*/
|
||||
nsresult FinishEncode(char ** aDest, char * aDestEnd,
|
||||
nsIUnicodeEncoder * aEncoder);
|
||||
|
||||
void PrintSpaces(int aCount);
|
||||
|
||||
nsresult AddArray(nsISupportsArray * aDest, nsISupportsArray * aSrc);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Main method of the program.
|
||||
*/
|
||||
nsresult Main(int aArgC, char ** aArgV);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Global functions and data [implementation]
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
nsTestUConv testObj;
|
||||
nsresult res;
|
||||
|
||||
res = testObj.Main(argc, argv);
|
||||
return (NS_FAILED(res));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Class nsTestLog [implementation]
|
||||
|
||||
const char * nsTestLog::kTraceDelimiter = ".";
|
||||
|
||||
void nsTestLog::AddTrace(char * aTrace)
|
||||
{
|
||||
mTrace.Append(aTrace);
|
||||
mTrace.Append(kTraceDelimiter);
|
||||
}
|
||||
|
||||
void nsTestLog::DelTrace(char * aTrace)
|
||||
{
|
||||
mTrace.Truncate(mTrace.Length() - strlen(aTrace) - strlen(kTraceDelimiter));
|
||||
}
|
||||
|
||||
void nsTestLog::PrintError(char * aCall, int aError)
|
||||
{
|
||||
const char * trace = mTrace.get();
|
||||
printf("ERROR at %s%s code=0x%x.\n", trace, aCall, aError);
|
||||
}
|
||||
|
||||
void nsTestLog::PrintError(char * aCall, char * aMessage)
|
||||
{
|
||||
const char * trace = mTrace.get();
|
||||
printf("ERROR at %s%s reason: %s.\n", trace, aCall, aMessage);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Class nsTestUConv [implementation]
|
||||
|
||||
nsresult nsTestUConv::TestEncoders()
|
||||
{
|
||||
char * trace = "TestEncoders";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager2> ccMan =
|
||||
do_GetService(kCharsetConverterManagerCID, &res);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsCOMPtr<nsISupportsArray> encoders;
|
||||
res = ccMan->GetEncoderList(getter_AddRefs(encoders));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
PRUint32 encoderCount;
|
||||
encoders->Count(&encoderCount);
|
||||
printf("There are %d encoders\n", encoderCount);
|
||||
|
||||
mLog.DelTrace(trace);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::TestDecoders()
|
||||
{
|
||||
char * trace = "TestDecoders";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
// XXX write me
|
||||
|
||||
mLog.DelTrace(trace);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::TestCharsetManager()
|
||||
{
|
||||
char * trace = "TestCharsetManager";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
const PRUnichar * name;
|
||||
nsCOMPtr<nsIAtom> csAtom;
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager2> ccMan =
|
||||
do_GetService(kCharsetConverterManagerCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("NS_WITH_SERVICE", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
// test alias resolving capability
|
||||
nsAutoString csAlias(NS_LITERAL_STRING("iso-10646-ucs-basic"));
|
||||
nsAutoString csName(NS_LITERAL_STRING("UTF-16BE"));
|
||||
res = ccMan->GetCharsetAtom(csAlias.get(), getter_AddRefs(csAtom));
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("GetCharsetAtom()", res);
|
||||
return res;
|
||||
}
|
||||
res = csAtom->GetUnicode(&name);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("get()", res);
|
||||
return res;
|
||||
}
|
||||
if (!csName.Equals(nsDependentString(name))) {
|
||||
mLog.PrintError("Equals()", "unexpected charset name");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// test self returning if alias was not found
|
||||
nsAutoString csAlias2(NS_LITERAL_STRING("Totally_dummy_charset_name"));
|
||||
res = ccMan->GetCharsetAtom(csAlias2.get(), getter_AddRefs(csAtom));
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("GetCharsetAtom()", res);
|
||||
return res;
|
||||
}
|
||||
res = csAtom->GetUnicode(&name);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("get()", res);
|
||||
return res;
|
||||
}
|
||||
if (!csAlias2.Equals(nsDependentString(name))) {
|
||||
mLog.PrintError("Equals()", "unexpected charset name");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
mLog.DelTrace(trace);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::DisplayDetectors()
|
||||
{
|
||||
char * trace = "DisplayDetectors";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager2> ccMan =
|
||||
do_GetService(kCharsetConverterManagerCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("NS_WITH_SERVICE", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
// charset detectors
|
||||
nsCOMPtr<nsISupportsArray> array;
|
||||
|
||||
res = ccMan->GetCharsetDetectorList(getter_AddRefs(array));
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("GetCharsetDetectorList()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
PRUint32 count;
|
||||
res = array->Count(&count);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("Count()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
printf("***** Character Set Detectors [%d] *****\n", count);
|
||||
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
nsCOMPtr<nsIAtom> cs;
|
||||
nsAutoString str;
|
||||
|
||||
res = array->GetElementAt(i, getter_AddRefs(cs));
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("GetElementAt()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
const PRUnichar * name;
|
||||
res = cs->GetUnicode(&name);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("get()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
str.Assign(name);
|
||||
NS_LossyConvertUCS2toASCII buff(str);
|
||||
printf("%s", buff.get());
|
||||
PrintSpaces(36 - buff.Length()); // align to hard coded column number
|
||||
|
||||
res = ccMan->GetCharsetTitle2(cs, &str);
|
||||
if (NS_FAILED(res)) str.SetLength(0);
|
||||
printf("\"%s\"\n", NS_LossyConvertUCS2toASCII(str).get());
|
||||
}
|
||||
|
||||
mLog.DelTrace(trace);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::DisplayCharsets()
|
||||
{
|
||||
char * trace = "DisplayCharsets";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager2> ccMan =
|
||||
do_GetService(kCharsetConverterManagerCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("NS_WITH_SERVICE", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupportsArray> array;
|
||||
nsCOMPtr<nsISupportsArray> encArray;
|
||||
|
||||
res = ccMan->GetDecoderList(getter_AddRefs(array));
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("GetDecoderList()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
res = ccMan->GetEncoderList(getter_AddRefs(encArray));
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("GetEncoderList()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
res = AddArray(array, encArray);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
PRUint32 count;
|
||||
res = array->Count(&count);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("Count()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
printf("***** Character Sets [%d] *****\n", count);
|
||||
|
||||
PRUint32 encCount = 0, decCount = 0;
|
||||
PRUint32 basicEncCount = 0, basicDecCount = 0;
|
||||
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
nsCOMPtr<nsIAtom> cs;
|
||||
nsAutoString str;
|
||||
nsAutoString prop;
|
||||
|
||||
res = array->GetElementAt(i, getter_AddRefs(cs));
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("GetElementAt()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
const PRUnichar * name;
|
||||
res = cs->GetUnicode(&name);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("get()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
str.Assign(name);
|
||||
NS_LossyConvertUCS2toASCII buff(str);
|
||||
printf("%s", buff.get());
|
||||
PrintSpaces(24 - buff.Length()); // align to hard coded column number
|
||||
|
||||
|
||||
nsCOMPtr<nsIUnicodeDecoder> dec = NULL;
|
||||
res = ccMan->GetUnicodeDecoder(cs, getter_AddRefs(dec));
|
||||
if (NS_FAILED(res)) printf (" ");
|
||||
else {
|
||||
printf("D");
|
||||
decCount++;
|
||||
}
|
||||
#ifdef NS_DEBUG
|
||||
// show the "basic" decoder classes
|
||||
if (dec) {
|
||||
nsCOMPtr<nsIBasicDecoder> isBasic = do_QueryInterface(dec);
|
||||
if (isBasic) {
|
||||
basicDecCount++;
|
||||
printf("b");
|
||||
}
|
||||
else printf(" ");
|
||||
}
|
||||
else printf(" ");
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIUnicodeEncoder> enc = NULL;
|
||||
res = ccMan->GetUnicodeEncoder(cs, getter_AddRefs(enc));
|
||||
if (NS_FAILED(res)) printf (" ");
|
||||
else {
|
||||
printf("E");
|
||||
encCount++;
|
||||
}
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
if (enc) {
|
||||
nsCOMPtr<nsIBasicEncoder> isBasic = do_QueryInterface(enc);
|
||||
if (isBasic) {
|
||||
basicEncCount++;
|
||||
printf("b");
|
||||
}
|
||||
else printf(" ");
|
||||
}
|
||||
else printf(" ");
|
||||
#endif
|
||||
|
||||
printf(" ");
|
||||
|
||||
prop.Assign(NS_LITERAL_STRING(".notForBrowser"));
|
||||
res = ccMan->GetCharsetData2(cs, prop.get(), &str);
|
||||
if ((dec != NULL) && (NS_FAILED(res))) printf ("B");
|
||||
else printf("X");
|
||||
|
||||
prop.Assign(NS_LITERAL_STRING(".notForComposer"));
|
||||
res = ccMan->GetCharsetData2(cs, prop.get(), &str);
|
||||
if ((enc != NULL) && (NS_FAILED(res))) printf ("C");
|
||||
else printf("X");
|
||||
|
||||
prop.Assign(NS_LITERAL_STRING(".notForMailView"));
|
||||
res = ccMan->GetCharsetData2(cs, prop.get(), &str);
|
||||
if ((dec != NULL) && (NS_FAILED(res))) printf ("V");
|
||||
else printf("X");
|
||||
|
||||
prop.Assign(NS_LITERAL_STRING(".notForMailEdit"));
|
||||
res = ccMan->GetCharsetData2(cs, prop.get(), &str);
|
||||
if ((enc != NULL) && (NS_FAILED(res))) printf ("E");
|
||||
else printf("X");
|
||||
|
||||
printf("(%3d, %3d) ", encCount, decCount);
|
||||
res = ccMan->GetCharsetTitle2(cs, &str);
|
||||
if (NS_FAILED(res)) str.SetLength(0);
|
||||
NS_LossyConvertUCS2toASCII buff2(str);
|
||||
printf(" \"%s\"\n", buff2.get());
|
||||
}
|
||||
|
||||
printf("%u of %u decoders are basic (%d%%)\n",
|
||||
basicDecCount, decCount, (basicDecCount * 100) / decCount);
|
||||
|
||||
printf("%u of %u encoders are basic (%d%%)\n",
|
||||
basicEncCount, encCount, (basicEncCount * 100) / encCount);
|
||||
mLog.DelTrace(trace);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::TestTempBug()
|
||||
{
|
||||
char * trace = "TestTempBug";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
nsAutoString charset(NS_LITERAL_STRING("ISO-2022-JP"));
|
||||
PRUnichar src[] = {0x0043, 0x004e, 0x0045, 0x0054, 0x0020, 0x004A, 0x0061,
|
||||
0x0070, 0x0061, 0x006E, 0x0020, 0x7DE8, 0x96C6, 0x5C40};
|
||||
PRUnichar * srcEnd = src + ARRAY_SIZE(src);
|
||||
char dest[BIG_BUFFER_SIZE];
|
||||
char * destEnd = dest + BIG_BUFFER_SIZE;
|
||||
|
||||
PRUnichar * p = src;
|
||||
char * q = dest;
|
||||
res = Encode(&p, srcEnd, &q, destEnd, &charset);
|
||||
|
||||
mLog.DelTrace(trace);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::Encode(PRUnichar ** aSrc, PRUnichar * aSrcEnd,
|
||||
char ** aDest, char * aDestEnd,
|
||||
nsString * aCharset)
|
||||
{
|
||||
char * trace = "Encode";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager> ccMan =
|
||||
do_GetService(kCharsetConverterManagerCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("NS_WITH_SERVICE", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIUnicodeEncoder> enc;
|
||||
res = ccMan->GetUnicodeEncoder(aCharset, getter_AddRefs(enc));
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("GetUnicodeEncoder()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
res = ConvertEncode(aSrc, aSrcEnd, aDest, aDestEnd, enc);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("Convert()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
res = FinishEncode(aDest, aDestEnd, enc);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("Finish()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
mLog.DelTrace(trace);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::ConvertEncode(PRUnichar ** aSrc, PRUnichar * aSrcEnd,
|
||||
char ** aDest, char * aDestEnd,
|
||||
nsIUnicodeEncoder * aEncoder)
|
||||
{
|
||||
PRUnichar * src = (*aSrc);
|
||||
char * dest = (*aDest);
|
||||
PRInt32 srcLen = aSrcEnd - src;
|
||||
PRInt32 destLen = aDestEnd - dest;
|
||||
|
||||
nsresult res = aEncoder->Convert(src, &srcLen, dest, &destLen);
|
||||
|
||||
(*aSrc) = src + srcLen;
|
||||
(*aDest) = dest + destLen;
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::FinishEncode(char ** aDest, char * aDestEnd,
|
||||
nsIUnicodeEncoder * aEncoder)
|
||||
{
|
||||
char * dest = (*aDest);
|
||||
PRInt32 destLen = aDestEnd - dest;
|
||||
|
||||
nsresult res = aEncoder->Finish(dest, &destLen);
|
||||
|
||||
(*aDest) = dest + destLen;
|
||||
return res;
|
||||
}
|
||||
|
||||
void nsTestUConv::PrintSpaces(int aCount)
|
||||
{
|
||||
for (int i = 0; i < aCount; i++) printf(" ");
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::AddArray(nsISupportsArray * aDest,
|
||||
nsISupportsArray * aSrc)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
PRUint32 count, i;
|
||||
|
||||
res = aSrc->Count(&count);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
nsCOMPtr<nsISupports> elem;
|
||||
res = aSrc->GetElementAt(i, getter_AddRefs(elem));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
PRInt32 index;
|
||||
res = aDest->GetIndexOf(elem, &index);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
if (index < 0) res = aDest->AppendElement(elem);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::Main(int aArgC, char ** aArgV)
|
||||
{
|
||||
char * trace = "Main";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (aArgC < 2) {
|
||||
// no arguments were passed to the program, so we just run the self tests
|
||||
res = TestCharsetManager();
|
||||
if (NS_SUCCEEDED(res)) res = TestEncoders();
|
||||
if (NS_SUCCEEDED(res)) res = TestDecoders();
|
||||
} else if (!strcmp(aArgV[1], "-tempbug")) {
|
||||
// we are testing a temporary bug
|
||||
res = TestTempBug();
|
||||
} else if (!strcmp(aArgV[1], "-display")) {
|
||||
// display all the available data
|
||||
res = DisplayDetectors();
|
||||
if (NS_SUCCEEDED(res)) res = DisplayCharsets();
|
||||
}
|
||||
|
||||
mLog.DelTrace(trace);
|
||||
return res;
|
||||
}
|
||||
@@ -1,211 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include <windows.h>
|
||||
#include <winnls.h>
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
static NS_DEFINE_IID(kICharsetConverterManagerIID, NS_ICHARSETCONVERTERMANAGER_IID);
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
void usage()
|
||||
{
|
||||
printf(
|
||||
"convperf -f fromcode -t tocode [file]\n"
|
||||
);
|
||||
}
|
||||
int fromcodeind = 0;
|
||||
int tocodeind = 0;
|
||||
FILE* infile = 0;
|
||||
#define INBUFSIZE (1024*16)
|
||||
#define MEDBUFSIZE (1024*16*2)
|
||||
#define OUTBUFSIZE (1024*16*8)
|
||||
char inbuffer[INBUFSIZE];
|
||||
char outbuffer[OUTBUFSIZE];
|
||||
PRUnichar medbuffer[MEDBUFSIZE];
|
||||
nsIUnicodeEncoder* encoder = nsnull;
|
||||
nsIUnicodeDecoder* decoder = nsnull;
|
||||
UINT incp = 932;
|
||||
UINT outcp = 932;
|
||||
|
||||
void memcpyDecode(const char* src, PRInt32 srclen, char* dest)
|
||||
{
|
||||
::memcpy(dest, src, srclen);
|
||||
}
|
||||
void memcpyEncode(const char* src, PRInt32 srclen, char* dest)
|
||||
{
|
||||
::memcpy(dest, src, srclen);
|
||||
}
|
||||
|
||||
void WideDecode(const char* src,
|
||||
PRInt32 srclen, PRUnichar *dest, PRInt32 *destLen)
|
||||
{
|
||||
const char* end = src+srclen ;
|
||||
while(src < end)
|
||||
*dest++ = (PRUnichar) *src++;
|
||||
*destLen = srclen;
|
||||
}
|
||||
void NarrowEncode(const PRUnichar *src,
|
||||
PRInt32 srclen, char* dest, PRInt32* destLen)
|
||||
{
|
||||
const PRUnichar* end = src+srclen ;
|
||||
while(src < end)
|
||||
*dest++ = (char) *src++;
|
||||
*destLen = srclen;
|
||||
}
|
||||
void msDecode(UINT cp, const char* src,
|
||||
PRInt32 srclen, PRUnichar *dest, PRInt32 *destLen)
|
||||
{
|
||||
*destLen = ::MultiByteToWideChar(cp, 0,src, srclen, (LPWSTR)dest, *destLen);
|
||||
if(*destLen <= 0)
|
||||
fprintf(stderr, "problem in ::MultiByteToWideChar\n");
|
||||
}
|
||||
void msEncode(UINT cp, const PRUnichar *src,
|
||||
PRInt32 srcLen, char* dest, PRInt32* destLen)
|
||||
{
|
||||
*destLen = ::WideCharToMultiByte(cp, 0, src, srcLen, (LPSTR)dest, *destLen,
|
||||
(LPCSTR)" ", FALSE);
|
||||
if(*destLen <= 0)
|
||||
fprintf(stderr, "problem in ::WideCharToMultiByte\n");
|
||||
}
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
nsresult res= NS_OK;
|
||||
nsICharsetConverterManager* ccMain=nsnull;
|
||||
// get ccMain;
|
||||
nsServiceManager::GetService(kCharsetConverterManagerCID,
|
||||
kICharsetConverterManagerIID, (nsISupports**) &ccMain);
|
||||
if(NS_FAILED(res))
|
||||
{
|
||||
fprintf(stderr, "Cannot get Character Converter Manager %x\n", res);
|
||||
}
|
||||
int i;
|
||||
if(argc > 5)
|
||||
{
|
||||
for(i =0; i < argc; i++)
|
||||
{
|
||||
if(strcmp(argv[i], "-f") == 0)
|
||||
{
|
||||
tocodeind = i+1;
|
||||
nsAutoString str; str.AssignWithConversion(argv[tocodeind]);
|
||||
res = ccMain->GetUnicodeDecoder(&str, &decoder);
|
||||
if(NS_FAILED(res)) {
|
||||
fprintf(stderr, "Cannot get Unicode decoder %s %x\n",
|
||||
argv[tocodeind],res);
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
if(strcmp(argv[i], "-t") == 0)
|
||||
{
|
||||
fromcodeind = i+1;
|
||||
nsAutoString str; str.AssignWithConversion(argv[fromcodeind]);
|
||||
res = ccMain->GetUnicodeEncoder(&str, &encoder);
|
||||
if(NS_FAILED(res)) {
|
||||
fprintf(stderr, "Cannot get Unicode encoder %s %x\n",
|
||||
argv[fromcodeind],res);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(argc == 6)
|
||||
{
|
||||
infile = fopen(argv[5], "rb");
|
||||
if(NULL == infile)
|
||||
{
|
||||
usage();
|
||||
fprintf(stderr,"cannot open file %s\n", argv[5]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
infile = stdin;
|
||||
}
|
||||
|
||||
PRInt32 insize,medsize,outsize;
|
||||
while((insize=fread(inbuffer, 1,INBUFSIZE,infile)) > 0)
|
||||
{
|
||||
medsize=MEDBUFSIZE;
|
||||
|
||||
res = decoder->Convert(inbuffer,&insize, medbuffer, &medsize);
|
||||
if(NS_FAILED(res)) {
|
||||
fprintf(stderr, "failed in decoder->Convert %x\n",res);
|
||||
return -1;
|
||||
}
|
||||
outsize = OUTBUFSIZE;
|
||||
res = encoder->Convert(medbuffer, &medsize, outbuffer,&outsize);
|
||||
if(NS_FAILED(res)) {
|
||||
fprintf(stderr, "failed in encoder->Convert %x\n",res);
|
||||
return -1;
|
||||
}
|
||||
fwrite(outbuffer, 1, outsize, stdout);
|
||||
|
||||
memcpyDecode(inbuffer, insize, outbuffer);
|
||||
|
||||
memcpyEncode(inbuffer, insize, outbuffer);
|
||||
|
||||
medsize = MEDBUFSIZE;
|
||||
msDecode(incp, inbuffer, insize, medbuffer, &medsize);
|
||||
|
||||
outsize = OUTBUFSIZE;
|
||||
msEncode(outcp, medbuffer, medsize, outbuffer, &outsize);
|
||||
|
||||
medsize = MEDBUFSIZE;
|
||||
WideDecode( inbuffer, insize, medbuffer, &medsize);
|
||||
|
||||
outsize = OUTBUFSIZE;
|
||||
NarrowEncode( medbuffer, medsize, outbuffer, &outsize);
|
||||
}
|
||||
|
||||
fclose(infile);
|
||||
fclose(stdout);
|
||||
fprintf(stderr, "Done!\n");
|
||||
return 0;
|
||||
}
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user