Hi :)

My second question is why Perl insists on keeping the BOM and printing it later

Because it would be insane to throw it away without being told to throw it away.

I would have expected it to be stripped during the initial read of the text file, since it's just packaging, and omitted in Perl's internal character representation.

Besides not being mere packaging it isn't "omitted"; Your expectations is wrong.

Overall, though, I'd like to learn where to fix the problem. Do I configure Windows differently? Do I read the text file differently in Perl? Or do I just print things differently in Perl? Any insights or suggestions will be greatly appreciated.

for cmd.exe change fonts, I read fonts are responsible for not showing BOM

or try PowerShell, I hear that thing is unicode by default, so it ought to come with fonts that know to hide BOM

or from perl, strip the bom , say by using :encoding(UTF-8):via(File::BOM), and/or skip printing BOM when -t Filehandle is opened to a tty (tty means console, cmd.exe )


I've seen lots of suggestions ...

Next time, include those links in your post :)

FWIW, Content-type is not charset

FWIW, utf8 is not UTF-8, the difference could be important

BUT, FWIW, you shouldn't specify charset (utf8 or UTF-8) to decoded_content, that is webservers job , it should just work already

My first question is why the CMD prompt isn't handling the BOM correctly,

seems to me something on MSDN would answer that :p


In reply to Re: can't get rid of BOM from UTF-8 webpage by Anonymous Monk
in thread can't get rid of BOM from UTF-8 webpage by BeneSphinx

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.