Allow me to propose the following, as a sort of experiment for you to perform. You can go ahead and fold this snippet into your perl script (it is a perl script you're talking about, isn't it?), and let us know what sort of output you see on your terminal as a result of running the code with this snippet.
# Let's pretend you have the troublesome string returned by your # DB, and that string is stored in a variable called "$db_string". # (if it's actually stored in a variable called "$x", you # could adapt it to this snippet by adding the line: # my $db_string = $x; my @db_chars = (); for my $db_char ( split //, $db_string ) { push @db_chars, sprintf( "%02x", ord( $db_char )); } for my $db_char ( @db_chars ) { printf "== %s == %s ==\n", $db_char, chr(hex($db_char)); }
That will show you the actual hex codes of each (single-byte) character in the string from the database, along with the way that single-byte character appears on your screen when printed in its "raw" form. If the database string is really long, you can limit the second loop to just enough iterations to clarify what's happening -- e.g. if 15 characters is enough:
for my $db_char ( @db_chars[0..14] ) { ...
Once you've done that, try to learn something about what is actually in the database. What language is it (Greek? Russian? Chinese?), what encoding is it in (ISO-8859?, utf8? GBK?), what is it supposed to look like when it's displayed correctly (and do you have the font needed to do that)?

In reply to Re: hexadecimal character by graff
in thread hexadecimal character by Anonymous Monk

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.