I assumed I needed "use utf8" as the Š characters are "in the code"
If your source file is UTF-8 encoded, you do. It decodes it.
but if I uncomment "use utf8", none of the translations or substitions have any effect, I just print out the original text each time.
I agree with moritz. That means the database is returning the strings encoded. You need to decode them.
my $p = $sth->fetchrow_hashref;
utf8::decode( $p->{town} );
my $town = $p->{town};
(The "utf8::" functions are always present. No need to "use" anything.)
-
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.
|