I've got what some might consider an interesting problem.

I have a russian version of windows nt. On it I have a little web server that will run perl cgi's (it is the cygwin distro of perl v5.8.0).

My html form's page (generated by perl) is encoded in utf-8. In the submission script, I am running a small win32 command line application (compiled with unicode support enabled) which will set a registry key to the parameter I pass to it.

Now, I can run the application from the command line and it works correctly (although the russian you enter in the dos prompt looks like garbage, it is the correct string when it hits the registry).

If I enter the reference characters ( Я ) into the form, this seems to work just fine. I'd rather not have my users be forced to enter this type of input.

If my html page is encoded with iso-8859-1, then my russian looks like garbage, but when I submit russian into the form, it is written to the registry as its reference characters (ie Я ). Then I can change my browsers encoding to utf-8 and all is well.

So it looks to me like the html page encoding matters. Is there some way I can convert my form data into the reference characters (This seems to work just fine with everything)? Or is there some other encoding that will play with my win32 app better? Are there any other solutions that would be better?

Thanks in advance for any help.

In reply to HTML Forms, utf-8, windows and perl by Avox

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.