In most character sets, including iso-8859-1 and Unicode, the pound symbol is 163 decimal, or 0xA3 hexadecimal, so you should use "chr(163)". If you use the correct encoding on the output, that will be translated to the correct character.
E.g. this perl -e 'binmode STDOUT, ":encoding(cp437)"; print chr(0xA3), "\n"' \
| od -c -t x1
0000000 234 \r \n
9c 0d 0a
(Code page 437 is a common code page for a DOS box on Windows, but it can be changed with CHCP.)
and this perl -e 'binmode STDOUT,":encoding(latin-1)"; print chr(0xA3),"\n"' \
| od -c -t x1
gives: 0000000 243 \r \n
a3 0d 0a
But, note that 156 (0x9c) does not work with the Encode translations:
perl -e 'binmode STDOUT, ":encoding(cp437)"; print chr(0x9C), "\n"' \
| od -c -t x1
Gives: "\x{009c}" does not map to cp437.
0000000 \ x { 0 0 9 c } \r \n
5c 78 7b 30 30 39 63 7d 0d 0a
If you are outputting to HTML, you also have to make sure the Content-type charset gets set correctly or output the characters as entities, e.g. £ or £
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|