PDA

View Full Version : 'Expected hexadecimal digit' error



glenngv
08-02-2002, 03:00 AM
ive got these lines in my script and IE generates the 'Expected hexadecimal digit' error:

str += '<NOBR>&nbsp;User name:\n';
str += "&lt;&gt;&quot;\'&amp;\\user\n"; // <>"'&\user


But when the username has no word 'user' at the end, it's ok:

str += '<NOBR>&nbsp;User name:\n';
str += "&lt;&gt;&quot;\'&amp;\\\n"; // <>"'&\

it's weird! anyone knows the cause? :confused:

adios
08-02-2002, 03:10 AM
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jserrexpectedhexadecimaldigit.asp

Escape something (I'd guess).

glenngv
08-02-2002, 03:15 AM
Originally posted by adios
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jserrexpectedhexadecimaldigit.asp

Escape something (I'd guess).

thanks adios!

i followed the link, and in the Note section it says:

Note If you want to use the literal text \u in a string, then use two backslashes - (\\u) - one to escape the first backslash.

I already did it, didn't I?

str += "&lt;&gt;"'&\\user\n";

adios
08-02-2002, 03:23 AM
...not following your use of quotes here:

str += "&lt;&gt;"'&\\\n"; :confused:

glenngv
08-02-2002, 03:36 AM
Originally posted by adios
...not following your use of quotes here:

str += "&lt;&gt;"'&\\\n"; :confused:


ok here it is again, sorry for the wrong posts earlier.
i was confused with all the special chars :D

str += "&lt;&gt;&quot;\'&amp;\\user\n";


this forum escapes the entities i typed;
here it is again, hope it's now correct...

str += "&amp;lt;&amp;gt;&amp;quot;\'&amp;amp;\\user\n";

adios
08-02-2002, 03:45 AM
I recently sweated over some string-wrangling regex code and the escaping issue nearly did me in (\\\\\\/ - does that fly?). How 'bout....

str += '&lt;&gt;"\'&\\user\n';

Just getting vBulletin to render this stuff is a challenge...

why don't I just give you my phone number & you can describe it to me....

[yetanotheredit]document.wrote that string and - it's fine! No errors...[yetanotheredit]

glenngv
08-02-2002, 04:05 AM
i took the screenshot of the lines, it's difficult to getting vBullettin to render the correct code (sigh!).

I cannot immediately changed the string value because it is generated on the server-side (the code is in C), only the string delimeter. I changed it to single quote but still the same error occurs.

glenngv
08-02-2002, 06:05 AM
i have fixed the problem, i didn't realize there are other lines that had the \u which caused the error.
thanks adios for the time and for reminding me that there is such an error in IE.