in reply to Re: DBD::Oracle - Character Encoding Conversion
in thread DBD::Oracle - Character Encoding Conversion

OK I think I jumped the gun on declaring it fixed. The issue is actually addressed in a CPAN bug here.

What was happening when I set the "ora_charset" attribute to "WE8ISO8859P15" in connect() was that it stores UTF8 strings into the column of the table. However, those strings should really be ISO-8859-15 because that is the default character set of the DB. (And the column is CHAR not NCHAR.)

So it looks like I'll need to convert the strings returned from the DB to UTF-8 manually. Not a big problem. If anyone has another idea, let me know.

  • Comment on Re^2: DBD::Oracle - Character Encoding Conversion

Replies are listed 'Best First'.
Re^3: DBD::Oracle - Character Encoding Conversion
by kennethk (Abbot) on Sep 22, 2015 at 16:20 UTC
    As a matter of etiquette, it's considered appropriate to reply to those who reply to you. In addition to maintaining a thread of conversation, PerlMonks can be configured to send a message when someone replies to one of your nodes, so it makes it more likely that the original respondent can continue assisting.

    Can you define manually? I've fixed corrupted files in the past using carefully crafted regular expressions, but that is usually not the right choice. Better would be using Encode to do transformations once you know how your input stream is formatted. Encode::Guess might be helpful there, though it has limited utility because it's such a messy problem. As some background, you should read through perluniintro if you haven't already.

    TL;DR- What you are proposing is possible, but sounds a lot like nested band-aids.


    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

      Pardon the breach of etiquette, I am new to these forums.

      By manually I meant explicitly. Here is the somewhat counter-intuitive code, where "$value" is from the hashref returned by a fetchall_hashref call:

      Encode::_utf8_off($value); $value = Encode::decode("utf8", $value);

      $value ends up being a Perl string with the utf8 flag on.

      Thanks!