alienhuman has asked for the wisdom of the Perl Monks concerning the following question:

This is more of a RFC than a traditional "here's the code, what do you think" type submission, but here goes:

I've inheirited a horrible piece of spaghetti CGI code that does the following:

Now the behavior that I've been tasked to fix is that special characters entered into the fields (i.e. the trademark symbol, the registration symbol, etc) are getting converted into something in the form "\xxx" where x is a number from 0-9 -- e.g. "\520". Adding to the weirdness is that depending on whether one uses a Mac or PC browser to enter the text into the form, the end "\xxx" is different. And if that wasn't enough, the purpose of the godawful ampersand delimited textfile is that it is used by a flash movie--and the flash movie displays totally different characters than the ones entered.

A final wrinkle: I'm using "vi" to inspect the end result on my Solaris box -- so the "\xxx" conversion may in fact be something that "vi" does. Argh!

My question: has anyone encountered cross-platform problems with special characters like this before? I'm going to rewrite this beast from scratch (using CGI.pm, course) but want to have some idea of when/where this problem crops up so I can deal with it from the get go.

Replies are listed 'Best First'.
Re: mac/pc character weirdness and cgi-lib
by alienhuman (Pilgrim) on Nov 05, 2001 at 22:42 UTC

    Resolved.

    It was not a perl issue. It was weirdness with the extended ascii character set that is used by Windows and the MacOS. And with the way that Flash needs to receive special ascii characters in order to display them properly.

    For those who are interested, Flash 5 will display any ascii character if it is encoded as hex, and preceeded by a percent sign. So "trademark" is %ae, e.g. Thanks to everyone who puzzled over this...