Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I'm pretty stumped. I'm pulling from a MySQL database using DBI, however I'm getting junk when I dump it to an array. Here's the code:

my $dbh = DBI->connect("DBI:mysql:$db_name1:$db_host1:$db_port1","$db_ +user1","$db_pw1", {RaiseError => 1, PrintError => 0, mysql_enable_utf +8 => 1, ChopBlanks =>0}); $log->debug("Running SQL Select statement: $sqlselect" . "\n"); my $RowSet = $dbh->selectall_arrayref("SELECT * FROM CollectionDB.ISI +S WHERE SourceID = '$PassedSource' ORDER BY ObjectKey DESC");

Now, after that I set each element of the array to a set of strings, then run data_string_desc on them. This is the result:

artTitle is ?????? ?? ??? ???? ???? ???? Encoding test on Title results: UTF8 off, ASCII, 28 characters 28 byte +s

I'm not sure how, even with UTF-8 enabled while DBI is connecting to the DB and UTF-8 set for every configuration on the database itself, the string is still appearing as ASCII. I need the UTF-8 because a majority of the data I'm bringing in is multibit (Chinese, Arabic, etc..)

Thanks in advance for any insight you can provide!


In reply to Encoding issue from DBI to string by ev0lution

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    [gnosti]: Hi, Looking for a module that can add HH:MM:SS durations like 1:40, 1:00:24.13 and 12.3? I see on CPAN more modules with absolute dates. TIA
    [kcott]: s/imput/input/
    [Corion]: DateTime::Duration ? Personally,I convert stuff to seconds using Time::Piece or Time::Local and then add the seconds and then use POSIX::strftime to print them as hours again
    [marto]: good morning all, TCIF
    [gnosti]: I'm reading from ffmpeg lengths of video clips in H:M:S and needing to add them and format them back to H:M:S for feeding back to ffmpeg
    [marioroy]: kcott Thanks
    [Corion]: gnosti: I would cheat and use my approach instead of dealing with durations as objects, or a module
    [Corion]: You could even do the calculation directly - my $duration = $H * 3600+ $M*60 + $S; strftime '%H:%M:%S', timelocal($duratio n)

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (9)
    As of 2017-08-18 08:57 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Who is your favorite scientist and why?



























      Results (297 votes). Check out past polls.

      Notices?