You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Bill Schindler <de...@bitranch.com> on 2000/02/16 12:24:42 UTC
[Xerces-C] IconvTransService::upperCase
The IconvTransService::uppercase method currently has this as its entire body:
towupper(*toUpperCase);
The result is that it's a no-op (unless there's two very different
platform-specific definitions for towupper()). It uppercases one character and
never stores it anywhere.
This bug shows up if you create an XML encoding in lowercase. Encodings like
"utf-8" and "iso-8859-1" create runtime exceptions, whereas "UTF-8" and
"ISO-8859-1" work. The encoding is passed through the upperCase() method --
which leaves the encoding in its original form.
Here's a patch to fix it.
Index: IconvTransService.cpp
===================================================================
RCS file:
/home/cvspublic/xml-xerces/c/src/util/Transcoders/Iconv/IconvTransService.cpp,v
retrieving revision 1.13
diff -u -r1.13 IconvTransService.cpp
--- IconvTransService.cpp 2000/02/11 03:10:19 1.13
+++ IconvTransService.cpp 2000/02/12 12:50:10
@@ -262,7 +262,12 @@
void IconvTransService::upperCase(XMLCh* const toUpperCase) const
{
- towupper(*toUpperCase);
+ XMLCh* outPtr = toUpperCase;
+ while (*outPtr)
+ {
+ *outPtr = towupper(*outPtr);
+ outPtr++;
+ }
}
(I think I sent this once, but it seems to have vanished into the bit bucket.
If this already went through once, my apologies!)
--Bill
Re: [Xerces-C] IconvTransService::upperCase
Posted by Arundhati Bhowmick <ar...@hyperreal.org>.
Thanks Bill for the patch. It's really a valid bug. I've checked in the changes.
You may extract the fresh codebase from the cvs repository. Also we're going have a
release any time now it'll be integrated in it.
Thanks again,
Arundhati
Bill Schindler wrote:
> The IconvTransService::uppercase method currently has this as its entire body:
>
> towupper(*toUpperCase);
>
> The result is that it's a no-op (unless there's two very different
> platform-specific definitions for towupper()). It uppercases one character and
> never stores it anywhere.
>
> This bug shows up if you create an XML encoding in lowercase. Encodings like
> "utf-8" and "iso-8859-1" create runtime exceptions, whereas "UTF-8" and
> "ISO-8859-1" work. The encoding is passed through the upperCase() method --
> which leaves the encoding in its original form.
>
> Here's a patch to fix it.
>
> Index: IconvTransService.cpp
> ===================================================================
> RCS file:
> /home/cvspublic/xml-xerces/c/src/util/Transcoders/Iconv/IconvTransService.cpp,v
> retrieving revision 1.13
> diff -u -r1.13 IconvTransService.cpp
> --- IconvTransService.cpp 2000/02/11 03:10:19 1.13
> +++ IconvTransService.cpp 2000/02/12 12:50:10
> @@ -262,7 +262,12 @@
>
> void IconvTransService::upperCase(XMLCh* const toUpperCase) const
> {
> - towupper(*toUpperCase);
> + XMLCh* outPtr = toUpperCase;
> + while (*outPtr)
> + {
> + *outPtr = towupper(*outPtr);
> + outPtr++;
> + }
> }
>
> (I think I sent this once, but it seems to have vanished into the bit bucket.
> If this already went through once, my apologies!)
>
> --Bill