$str contains "weight_\x{2639},weight_\x{c2}", what I would expect from joining "weight_\x{2639}" and "weight_\x{c2}". All I see missing is where you encod your output
# Encode input from/output to STDIN/STDOUT/STDERR as per locale
use open ':std', ':locale';
# Force UTF-8 input/output for STDIN/STDOUT/STDERR
use open ':std', ':encoding(UTF-8)';
You'll get better diagnostic output from Devel::Peek's Dump. For example, Dump($str) gives
SV = PV(0x81e829c) at 0x814ecdc
REFCNT = 1
FLAGS = (PADBUSY,PADMY,POK,pPOK,UTF8)
PV = 0x81fe838 "weight_\342\230\271,weight_\303\202"\0 [UTF8 "weight
+_\x{2639},weight_\x{c2}"]
CUR = 20
LEN = 24
You see both the external and internal representation.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.