[ 
https://issues.apache.org/jira/browse/XERCESC-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12556189#action_12556189
 ] 

cryptonomicon edited comment on XERCESC-1773 at 1/5/08 1:07 AM:
-----------------------------------------------------------------

Am going to try this in my own version  - will solve it in the case of numbers 
following a space only by skipping the %3 part of %3n where n is a number from 
0 to 9 . Escaped numbers seem to  be 30 added to the digit

This should work as a temporary fix - but is not a general solution

void XMLUri::normalizeURI(const XMLCh*     const systemURI,
                                XMLBuffer&       normalizedURI)
{
    const XMLCh* pszSrc = systemURI;

    normalizedURI.reset();

    while (*pszSrc) 
    {

        if ((*(pszSrc) == chPercent)
        &&  (*(pszSrc+1) == chDigit_2)
        &&  (*(pszSrc+2) == chDigit_0))
        {
            pszSrc += 3;
            normalizedURI.append(chSpace);
        }
        else 
        {
            //BT Fix - now remove the %3 from escaped numbers - numbers have 30 
added to them by the looks
            //so 1 escapes to %31 and will unescape by removing the %3

            if ((*(pszSrc) == chPercent) &&  (*(pszSrc+1) == chDigit_3))
            {
                pszSrc += 2;
            }
            else 
            {
                normalizedURI.append(*pszSrc);
                pszSrc++;
            }
        }
    }
}


      was (Author: cryptonomicon):
    Am going to try this in my own version  - will solve it in the case of 
numbers following a space only by skipping the %3 part of %3n where n is a 
number from 0 to 9 . Escaped numbers seem to  be 30 added to the digit

This should work as a temporary fix - but is not a general solution

void XMLUri::normalizeURI(const XMLCh*     const systemURI,
                                XMLBuffer&       normalizedURI)
{
    const XMLCh* pszSrc = systemURI;

    normalizedURI.reset();

    while (*pszSrc) 
    {

        if ((*(pszSrc) == chPercent)
        &&  (*(pszSrc+1) == chDigit_2)
        &&  (*(pszSrc+2) == chDigit_0))
        {
            pszSrc += 3;
            normalizedURI.append(chSpace);
        }
        else 
        {
            //BT Fix - now remove the %3 from escaped numbers - numbers have 30 
added to them by the looks
            //so 1 escapes to %31 and will unescape by removing the %3

            if ((*(pszSrc) == chPercent) &&  (*(pszSrc+1) == chDigit_3)
            {
                pszSrc += 2;
            }
            else 
            {
                normalizedURI.append(*pszSrc);
                pszSrc++;
            }
        }
    }
}

  
> Spaces in Filenames problem with XMLUri::normalizeURI
> -----------------------------------------------------
>
>                 Key: XERCESC-1773
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1773
>             Project: Xerces-C++
>          Issue Type: Bug
>         Environment: WindowsXP 64
>            Reporter: Brenton Thomas
>             Fix For: 2.8.0
>
>
> When using a filename containing spaces that has been escaped by a %20 you 
> end up with problems if the space is followed by a number. For example if you 
> have a directory  "D:\Home\Development\StrawberryFields 2.0" you need to 
> escape it to give "D:\Home\Development\StrawberryFields%202.0"  - which is 
> obviously going to break because it confuses the 2 at the end.  To fix this 
> you escape the number following the space to give 
> "D:\Home\Development\StrawberryFields%20%32.0" .  
> This is OK in terms of providing a legal schemaLocation except....
> The routine XMLUri::normalizeURI  then takes the escaped name and unescapes 
> it to return a form the system recognises.  What it needs to do is parse 
> through the string and unescape everything - not just the %20 
> void XMLUri::normalizeURI(const XMLCh*     const systemURI,
>                                 XMLBuffer&       normalizedURI)
> {
>     const XMLCh* pszSrc = systemURI;
>     normalizedURI.reset();
>     while (*pszSrc) {
>         if ((*(pszSrc) == chPercent)
>         &&  (*(pszSrc+1) == chDigit_2)
>         &&  (*(pszSrc+2) == chDigit_0))
>         {
>             pszSrc += 3;
>             normalizedURI.append(chSpace);
>         }
>         else 
>         {
>             normalizedURI.append(*pszSrc);
>             pszSrc++;
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to