You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by zjliu <zj...@fm365.com> on 2000/12/14 04:48:41 UTC
A small problem about dealing with code.
Hello xerces-c-dev,
What I am using is xerces-c-src_1_2_0.
what xerces supports when it deal with file name is Unicode.
I have traced in to the program and found a problem in
Win32Platformutils.cpp
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName).
It has some comments like that and so does it deal with the code.
// Ok, this might look stupid but its a semi-expedient way to deal
// with a thorny problem. Shift-JIS and some other Asian encodings
// are fundamentally broken and map both the backslash and the Yen
// sign to the same code point. Transcoders have to pick one or the
// other to map '\' to Unicode and tend to choose the Yen sign.
//
// Unicode Yen or Won signs as directory separators will fail.
//
// So, we will check this path name for Yen or won signs and, if they are
// there, we'll replace them with slashes.
But when I used a file name with Chinese Word,some Chinese word
include the Yen or Won signs when used ::mbstowcs and ::wcstombs to
convert the code.It converted a code which is part of a Chinese
word to chForwardSlash,then the program broken.
So I mean this method to deal with Japanese and Korea word is not
good.And I think why use ::mbstowcs and ::wcstombs,
::MultiByteToWideChar and ::WideCharToMultiByte may be better.
Can I delete the part of program code to support Chinese words
without producing some other problems?
the following is the code I want to delete:
const XMLCh* srcPtr = fileName;
while (*srcPtr)
{
if (*srcPtr == chYenSign ||
*srcPtr == chWonSign)
break;
srcPtr++;
}
//
// If we found a yen, then we have to create a temp file name. Else
// go with the file name as is and save the overhead.
//
if (*srcPtr)
{
tmpUName = XMLString::replicate(fileName);
XMLCh* tmpPtr = tmpUName;
while (*tmpPtr)
{
if (*tmpPtr == chYenSign ||
*tmpPtr == chWonSign)
*tmpPtr = chForwardSlash;
tmpPtr++;
}
nameToOpen = tmpUName;
}
--
Best regards,
zjliu mailto:zjliu@fm365.com