Skip to content
Snippets Groups Projects
Commit 01f459d5 authored by Alberto Massari's avatar Alberto Massari
Browse files

In the Windows registry, the code page for an encoding is stored in...

In the Windows registry, the code page for an encoding is stored in MIME\Database\Charset\<encoding>\@InternetEncoding, not in MIME\Database\Charset\<encoding>\@Codepage (XERCESC-1092)

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@529526 13f79535-47bb-0310-9956-ffa450edef68
parent c5fe9310
No related branches found
No related tags found
No related merge requests found
...@@ -146,14 +146,12 @@ public : ...@@ -146,14 +146,12 @@ public :
CPMapEntry CPMapEntry
( (
const XMLCh* const encodingName const XMLCh* const encodingName
, const unsigned int cpId
, const unsigned int ieId , const unsigned int ieId
); );
CPMapEntry CPMapEntry
( (
const char* const encodingName const char* const encodingName
, const unsigned int cpId
, const unsigned int ieId , const unsigned int ieId
); );
...@@ -165,7 +163,6 @@ public : ...@@ -165,7 +163,6 @@ public :
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
const XMLCh* getEncodingName() const; const XMLCh* getEncodingName() const;
const XMLCh* getKey() const; const XMLCh* getKey() const;
unsigned int getWinCP() const;
unsigned int getIEEncoding() const; unsigned int getIEEncoding() const;
...@@ -185,16 +182,10 @@ private : ...@@ -185,16 +182,10 @@ private :
// This is the encoding name for the code page that this instance // This is the encoding name for the code page that this instance
// represents. // represents.
// //
// fCPId
// This is the Windows specific code page for the encoding that this
// instance represents.
//
// fIEId // fIEId
// This is the IE encoding id. Its not used at this time, but we // This is the code page id.
// go ahead and get it and store it just in case for later.
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
XMLCh* fEncodingName; XMLCh* fEncodingName;
unsigned int fCPId;
unsigned int fIEId; unsigned int fIEId;
}; };
...@@ -202,10 +193,8 @@ private : ...@@ -202,10 +193,8 @@ private :
// CPMapEntry: Constructors and Destructor // CPMapEntry: Constructors and Destructor
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
CPMapEntry::CPMapEntry( const char* const encodingName CPMapEntry::CPMapEntry( const char* const encodingName
, const unsigned int cpId
, const unsigned int ieId) : , const unsigned int ieId) :
fEncodingName(0) fEncodingName(0)
, fCPId(cpId)
, fIEId(ieId) , fIEId(ieId)
{ {
// Transcode the name to Unicode and store that copy // Transcode the name to Unicode and store that copy
...@@ -231,11 +220,9 @@ CPMapEntry::CPMapEntry( const char* const encodingName ...@@ -231,11 +220,9 @@ CPMapEntry::CPMapEntry( const char* const encodingName
} }
CPMapEntry::CPMapEntry( const XMLCh* const encodingName CPMapEntry::CPMapEntry( const XMLCh* const encodingName
, const unsigned int cpId
, const unsigned int ieId) : , const unsigned int ieId) :
fEncodingName(0) fEncodingName(0)
, fCPId(cpId)
, fIEId(ieId) , fIEId(ieId)
{ {
fEncodingName = XMLString::replicate(encodingName, XMLPlatformUtils::fgMemoryManager); fEncodingName = XMLString::replicate(encodingName, XMLPlatformUtils::fgMemoryManager);
...@@ -261,11 +248,6 @@ const XMLCh* CPMapEntry::getEncodingName() const ...@@ -261,11 +248,6 @@ const XMLCh* CPMapEntry::getEncodingName() const
return fEncodingName; return fEncodingName;
} }
unsigned int CPMapEntry::getWinCP() const
{
return fCPId;
}
unsigned int CPMapEntry::getIEEncoding() const unsigned int CPMapEntry::getIEEncoding() const
{ {
return fIEId; return fIEId;
...@@ -273,9 +255,6 @@ unsigned int CPMapEntry::getIEEncoding() const ...@@ -273,9 +255,6 @@ unsigned int CPMapEntry::getIEEncoding() const
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// class Win32TransService Implementation ... // class Win32TransService Implementation ...
...@@ -360,6 +339,9 @@ Win32TransService::Win32TransService() ...@@ -360,6 +339,9 @@ Win32TransService::Win32TransService()
// interested in. There should be a code page entry and an // interested in. There should be a code page entry and an
// IE entry. // IE entry.
// //
// The Codepage entry is the default code page for a computer using that charset
// while the InternetEncoding holds the code page that represents that charset
//
unsigned long theType; unsigned long theType;
unsigned int CPId; unsigned int CPId;
unsigned int IEId; unsigned int IEId;
...@@ -398,7 +380,7 @@ Win32TransService::Win32TransService() ...@@ -398,7 +380,7 @@ Win32TransService::Win32TransService()
continue; continue;
} }
CPMapEntry* newEntry = new CPMapEntry(nameBuf, CPId, IEId); CPMapEntry* newEntry = new CPMapEntry(nameBuf, IEId);
fCPMap->put((void*)newEntry->getEncodingName(), newEntry); fCPMap->put((void*)newEntry->getEncodingName(), newEntry);
} }
} }
...@@ -486,7 +468,7 @@ Win32TransService::Win32TransService() ...@@ -486,7 +468,7 @@ Win32TransService::Win32TransService()
// //
if (::wcscmp(uniName, aliasedEntry->getEncodingName())) if (::wcscmp(uniName, aliasedEntry->getEncodingName()))
{ {
CPMapEntry* newEntry = new CPMapEntry(uniName, aliasedEntry->getWinCP(), aliasedEntry->getIEEncoding()); CPMapEntry* newEntry = new CPMapEntry(uniName, aliasedEntry->getIEEncoding());
fCPMap->put((void*)newEntry->getEncodingName(), newEntry); fCPMap->put((void*)newEntry->getEncodingName(), newEntry);
} }
...@@ -611,7 +593,6 @@ Win32TransService::makeNewXMLTranscoder(const XMLCh* const encoding ...@@ -611,7 +593,6 @@ Win32TransService::makeNewXMLTranscoder(const XMLCh* const encoding
return new (manager) Win32Transcoder return new (manager) Win32Transcoder
( (
encodingName encodingName
, theEntry->getWinCP()
, theEntry->getIEEncoding() , theEntry->getIEEncoding()
, blockSize , blockSize
, manager , manager
...@@ -636,14 +617,12 @@ Win32TransService::makeNewXMLTranscoder(const XMLCh* const encoding ...@@ -636,14 +617,12 @@ Win32TransService::makeNewXMLTranscoder(const XMLCh* const encoding
// Win32Transcoder: Constructors and Destructor // Win32Transcoder: Constructors and Destructor
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
Win32Transcoder::Win32Transcoder(const XMLCh* const encodingName Win32Transcoder::Win32Transcoder(const XMLCh* const encodingName
, const unsigned int winCP
, const unsigned int ieCP , const unsigned int ieCP
, const unsigned int blockSize , const unsigned int blockSize
, MemoryManager* const manager) : , MemoryManager* const manager) :
XMLTranscoder(encodingName, blockSize, manager) XMLTranscoder(encodingName, blockSize, manager)
, fIECP(ieCP) , fIECP(ieCP)
, fWinCP(winCP)
{ {
} }
...@@ -683,7 +662,7 @@ Win32Transcoder::transcodeFrom( const XMLByte* const srcData ...@@ -683,7 +662,7 @@ Win32Transcoder::transcodeFrom( const XMLByte* const srcData
// If we are looking at a leading byte of a multibyte sequence, // If we are looking at a leading byte of a multibyte sequence,
// then we are going to eat 2 bytes, else 1. // then we are going to eat 2 bytes, else 1.
// //
unsigned char toEat = ::IsDBCSLeadByteEx(fWinCP, *inPtr) ? unsigned char toEat = ::IsDBCSLeadByteEx(fIECP, *inPtr) ?
2 : 1; 2 : 1;
// Make sure a whol char is in the source // Make sure a whol char is in the source
...@@ -693,7 +672,7 @@ Win32Transcoder::transcodeFrom( const XMLByte* const srcData ...@@ -693,7 +672,7 @@ Win32Transcoder::transcodeFrom( const XMLByte* const srcData
// Try to translate this next char and check for an error // Try to translate this next char and check for an error
const unsigned int converted = ::MultiByteToWideChar const unsigned int converted = ::MultiByteToWideChar
( (
fWinCP fIECP
, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS , MB_PRECOMPOSED | MB_ERR_INVALID_CHARS
, (const char*)inPtr , (const char*)inPtr
, toEat , toEat
...@@ -767,7 +746,7 @@ Win32Transcoder::transcodeTo(const XMLCh* const srcData ...@@ -767,7 +746,7 @@ Win32Transcoder::transcodeTo(const XMLCh* const srcData
// Do one char and see if it made it. // Do one char and see if it made it.
const unsigned int bytesStored = ::WideCharToMultiByte const unsigned int bytesStored = ::WideCharToMultiByte
( (
fWinCP fIECP
, WC_COMPOSITECHECK | WC_SEPCHARS , WC_COMPOSITECHECK | WC_SEPCHARS
, srcPtr , srcPtr
, 1 , 1
...@@ -840,7 +819,7 @@ bool Win32Transcoder::canTranscodeTo(const unsigned int toCheck) const ...@@ -840,7 +819,7 @@ bool Win32Transcoder::canTranscodeTo(const unsigned int toCheck) const
BOOL usedDef; BOOL usedDef;
const unsigned int bytesStored = ::WideCharToMultiByte const unsigned int bytesStored = ::WideCharToMultiByte
( (
fWinCP fIECP
, WC_COMPOSITECHECK | WC_SEPCHARS , WC_COMPOSITECHECK | WC_SEPCHARS
, srcBuf , srcBuf
, srcCount , srcCount
......
...@@ -132,7 +132,6 @@ public : ...@@ -132,7 +132,6 @@ public :
Win32Transcoder Win32Transcoder
( (
const XMLCh* const encodingName const XMLCh* const encodingName
, const unsigned int winCP
, const unsigned int ieCP , const unsigned int ieCP
, const unsigned int blockSize , const unsigned int blockSize
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
...@@ -180,13 +179,10 @@ private : ...@@ -180,13 +179,10 @@ private :
// Private data members // Private data members
// //
// fIECP // fIECP
// This is the internet explorer code page for this encoding. // This is the code page for this encoding.
// //
// fWinCP
// This is the windows code page for this encoding.
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
unsigned int fIECP; unsigned int fIECP;
unsigned int fWinCP;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment