Look at Unicode::String, to see if this gives you anything you can use.

If you are using the term "unicode" to refer to "ucs2" or "utf16" (i.e. full 16-bit unicode encoding, as opposed to utf8, which is variable-width encoding), then one thing that might be screwing you up is byte order. Does your existing utf16 use network (big-endian) or wintel byte order? (Do the unicode strings start with byte-order marks?)

What do you mean by "garbage"? Is it that your perl script cannot display the unicode strings in any intelligible manner, or is the data getting "updated" or "rearranged" or otherwise "filtered" in some inappropriate way? Do you want to keep everything in unicode, or would you rather convert to ANSI?

If you'd like folks to send you answers rather than questions, give us some snippets of code, and some input and output that illustrate the problem.

UPDATE: Forgive me, that last bit was unfair -- I haven't tried posting unicode data to this site yet, and it may not be all that easy to do. But a sample of code that illustrates what you are trying to do would be very helpful, as well as some additional detail about what the source data looks like (e.g. give us a short string of byte pairs in hex notation), and a better idea of what your script is producing, and what you actually want it to produce.


In reply to Re: Problems with Unicode files generated with SQL Server by graff
in thread Problems with Unicode files generated with SQL Server by Cuchulain

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.