Print

Print


Ah, I think you're right, non \u escapes would signal a failure.   
Thanks Ben.

Sean

On Mar 2, 2011, at 4:50 PM, Ben Stabile wrote:

> Encoding/decoding of strings was not working correctly with escape  
> characters for me. I had to change the decoding switch case somewhat  
> because it was falling into the "unicode sequence" trap for no  
> apparent reason.
>
> The following change was necessary to make this work (but see the  
> warning below before making this change without checking your own  
> sources):
>
> [Code.java, line 479]
>
>                 else if (c=='\\')  // escape
>                     {
>                     x++;
>                     if ( x >= len )
>                         { d.type = DecodeReturn.T_ERROR; d.s =  
> "Unterminated String"; return; }
>                     if (dat.charAt(x)!='u' && inUnicode)
>                         { d.type = DecodeReturn.T_ERROR; d.s =  
> "Escape character in Unicode sequence"; return; }
>                     switch (dat.charAt(x))
> ...
>
> CAVEAT EMPTOR: I am working with significantly altered sources at  
> the moment, so this may not show up for others the way it has for  
> me. I am referencing the original source code linenumber above. If  
> you don't use the "Code" class for this kind of thing, you might  
> want to just ignore this. ;-)
>
> Regards,
> Ben S.
>
>
>