in reply to dynamically detect code page

What you're proposing is to try to fix something that is needlessly broken to begin with. It would be better if you could avoid this problem in the first place, by simply logging different language messages to different logs, possibly bearing such catchy file names as "japanese.log", "german.log", and so on.

If this isn't feasible (your PHB wrote the script and wants you to use it), then you will probably need to pull this log apart, line-by-line, like so:

if ($line =~/JAP/) { # Logic to print to the Japanese file...; } elsif ($line =~/GER/) { # Logic to print to the German file...; } else { # Logic to print to the English file...; };

It seems to me that it is probably not necessary for you to recreate each line in its original language, at the same time (for the same user). Chances are that most people won't speak (and read) all the languages that are being used.

Replies are listed 'Best First'.
Re^2: dynamically detect code page
by edwardt_tril (Sexton) on Feb 24, 2006 at 07:38 UTC
    Hi thanks for all the replies. The GER- and JAP- is just the
    computer name and is user defined and has no replationship with the actual encoding of the log line. I have
    no control of the log file because it is given as an output form some other program. .... :<