Forum Moderators: DixonJones

Message Too Old, No Replies

JavaScript error reporting gone mad

Help to understand gobbldegook Javascript messages appreciated

         

ChrisXenon

1:43 pm on Apr 16, 2002 (gmt 0)

10+ Year Member



My website includes a logging system which is invoked by a JavaSctipt function called record(). (This function goes on to invoke Perl which actually does the logging.)

The definition and call for record() are placed in a JavaScript include file,
which is present in all of the site webpages.

The relevant part of that include file is below:

function report_error(msg, url, line)
{
record('WEBPAGEERROR>>> msg='+msg+', url='+url+', line='+line);
self.onerror = dummy;
return true;
};
self.onerror = report_error;

- this works, but sometimes the function generates log entries like this:

WEBPAGEERROR>>> msg=u672Au7ED3u675Fu7684u5B57u7B26u4E32u5E38u91CF, url=<a URL at my website>, line=49

Here's more information:

0. This system does deliver regular, readable JavaScript errors as well

1. the gobbldegook is not random. Fragments of them are common to many messages

2. there are some "popular" line numbers, but they don't seem to correspond to real code
- the line might be in the middle of a comment, for example.
(I know that the line number may refer to an included file rather than
the "hosting" file)

3. I cannot reproduce these errors my testing at the site

4. The logs show between 0 and 50 such entries each day; when present they come persistently from a few users.

5. The logs also confirm that far more people do NOT see these errors in the same parts
of the website than do.

6. Browsers for these log entries are IE5+

Any ideas?

Thanks,
Chris

tedster

3:21 am on Apr 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm going to move this thread to the Tracking forum, hopipng for some more informed input.

bird

10:03 am on Apr 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



u672Au7ED3u675Fu7684u5B57u7B26u4E32u5E38u91CF

Looks like a unicode string to me. You can split it like this:

u672A u7ED3 u675F u7684 u5B57 u7B26 u4E32 u5E38 u91CF

Now find the correct language and character set for those codes, and ask someone who understands the language to translate them for you... ;)

ChrisXenon

10:54 am on Apr 17, 2002 (gmt 0)

10+ Year Member



Thanks Bird!

Getting from that fact to a useful course of action is difficult, though.

We're saying that Javascript errors are being generated by my code in some browsers.
Those error messages are delivered to my Javascript code in Unicode format.
And that unicode is being dumped raw into my weblogs.

I thought Unicode use was supposed to be entirely transparent.

I wonder why some times I get plain text and others Unicode
- it doesn't seem to be browser version dependent.

I can't even find a translator online so I can read the Unicode to understand then correct the Javascript errors.

I'm just thinking out loud here (or am I whining?).

I'd be grateful if anyone can help here.

Thanks,
Chris

bird

11:28 am on Apr 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How's this for a start:

[macchiato.com...]

If you enter the string "672A 7ED3 675F 7684 5B57 7B26 4E32 5E38 91CF" into the left box, and set the input type to "UTF-16M", and the output type of the right box to "Text", then it will display what looks like chinese (or japanese?) characters to me. You may have to bug one of the chinese speaking WebmasterWorld members about what it all means... ;)

The string in your logs is not raw unicode. It's an ascii representation of hex encoded unicode values for each character. Looks like JavaScript choses that representation when it has to send a unicode string to the Perl script on the server.

Unicode is not transparent by default. It is only transparent when all components in the processing chain can handle it, and especially when each component knows that the other components do so as well. If the status of one component is unknown, then an ascii encoding may be the safest way to circumvent the problem.

Whether you get such messages or not doesn't depend on the browser version, but on the language and charset the user has configured for his system.

ChrisXenon

4:26 pm on Apr 17, 2002 (gmt 0)

10+ Year Member



Thanks again, Bird, for your help.

I can't get the translator to work as you describe, but in any case - the prospect of finding someone who can translate this is too daunting so I applied some lateral thinking.

Knowing now what that this stuff is Unicode (thanks to you) I can surmise that the messages are the equivalents of those which appear in English, for any given JavaScript line number.

This helps me somewhat, though the line numbers still don't map to areas of code which seem to be capable of generating such errors.

Anyway, I'll press on with it. I'm tidying up the code in general, and eliminating quite a lot of it as a consequence. Perhaps it'll all just go away. So much for cool piercing intellect!

Thanks again,
Chris

bill

5:11 am on Apr 18, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you run that string thru Babel Fish [world.altavista.com] and set it to translate from Chinese to English then you get:

Not finished character string constant

ChrisXenon

8:17 am on Apr 18, 2002 (gmt 0)

10+ Year Member



Thanks Bill!