in reply to Re: Russian Language read from mysql into perl script problem
in thread Russian Language read from mysql into perl script problem

Ok, I changed it to:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
then I went into the table and had it save the content in the russian language again, now when I went to the editor and viewed it again I see this:

Current Content(on Page):
???????? - ???????????????? ????
Content in Database(in MySql)As displayed here:
Принимаю - зарегистрировать меня

So it still does not seem to work.
when I pulls the russian language directly out of the datbase for some reason it just shows the ?? on the page, when I view the source I also only see the ?? on the page, so it seems to be Perl, because the source code should be what is in the table right?

I don't know... still confused by it.

Thank you and I do appreciate any further advice.

thx,
Richard

Replies are listed 'Best First'.
Re^3: Russian Language read from mysql into perl script problem
by ikegami (Patriarch) on Feb 24, 2010 at 05:24 UTC

    Ok, my assumption was wrong. My question is still relevant, so I'll ask it again, with some additional questions.

    • What content type do you specify in the actual HTTP header. You've only shown the the content type you tell the browser the header should have contained.

    • How do you encode the HTML you send to the browser?

    • What do you get if you Dump the value you get from the database? (Output sent to STDERR, so you'll probably have to check your logs.)

      Ok, I am going to install Devel::Peek and do a dump to see... I'll create a new reply with that when I'm done. To answer the other question:

      What content type do you specify in the actual HTTP header. You've only shown the the content type you tell the browser the header should have contained.
      Response: Here is the html output perl is printing:
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-U +S"> <head> <title>Richard's Back Office Manager</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-language" content="RU"> <meta name="audience" content="All" />
      That is the first part of the header.

      How do you encode the HTML you send to the browser?

      Response: I don't really 'encode' it, here is how I write that page that has the problem displaying the database content:

      #Get the content of the language tag to be edited from the dat +abase table... my $sth = $dbh->prepare(qq{select * from `$_tableName` where ` +lngId` = ?}); $sth->execute($in{lngId}); my $_tr = $sth->fetchrow_hashref(); $sth->finish(); # Got it... Check if this langauge is NOT the english version +if not then get the english version of the same tag to show the curre +nt content... if($_tableName ne "en_lang") { $sth = $dbh->prepare(qq{select * from `en_lang` where `lng +Id` = ?}); $sth->execute($in{lngId}); my $_enLang = $sth->fetchrow_hashref(); $sth->finish(); } # Build the web form $_page_content contains the whole page co +ntent which will then print in the template of the design at the end +of the programming... $_page_content .= start_form(-name=>"edit_form", -action=>url( +), -method=>"POST") . hidden(-name=>"pg") . hidden(-name=>"do") . hidden(-name=>"view", -value=>"saveTag", -override=>1) . hidden(-name=>"lngId") . hidden(-name=>"r") . hidden(-name=>"q") . hidden(-name=>"p") . hidden(-name=>"timel", -value=>time(), -override=>1) . $hidden_inc_sess_id . qq~ <table border="0" cellpadding="2" cellspacing="2" align="cente +r" width="650"> <tr> <td class="td_header_green" colspan="2"> Modify a Language Tag </td> </tr> <tr> <td class="label_cell"> Language: </td> <td class="non_label_cell"> $_languagenames{$_tableName} </td> </tr> <tr> <td class="label_cell"> Last Modified: </td> <td class="non_label_cell"> ~ . buildDate($_tr->{d},"common_layout_wt") . qq~ </td> </tr> <tr> <td class="label_cell"> Tag: </td> <td class="non_label_cell"> $_tr->{tag} </td> </tr> <tr> <td class="label_cell_center" colspan="2"> Current Content: </td> </tr> <tr> <td class="non_label_cell_center" colspan="2"> $_tr->{value} <!-- This displays the Content from +the database... --> </td> </tr> <tr> <td class="label_cell_center" colspan="2"> New Content: </td> </tr> <tr> <td class="non_label_cell_center" colspan="2"> ~ . textarea(-name=>"tagvalue", -default=>$_tr->{v +alue}, -onfocus=>"this.select()", -cols=>85, -rows=>10, -class=>"form +field") . qq~ </td> </tr> ~; # again check if this tag is not the english version if no +t, then show the english version now so they know what they should be + translating... if($_tableName ne "en_lang") { $_page_content .= qq~ <tr> <td class="label_cell" colspan="2"> English Version Content: </td> </tr> <tr> <td class="non_label_cell_center" colspan="2"> $_enLang->{value} </td> </tr> <tr> <td class="label_cell"> English Version Last Modified: </td> <td class="non_label_cell"> ~ . buildDate($_enLang->{d},"common_layout_wt") . +qq~ </td> </tr> ~; } # Done checking english version or not... complete the for +m. $_page_content .= qq~ <tr> <td class="non_label_cell_center" colspan="2"> ~ . submit(-name=>"choice", -value=>"Save Changes" +, -class=>"submit") . qq~ </td> </tr> </table> ~ . end_form() . br() x 2; # done building the web form and pa +ge...

      Ok, I will now go install the dump system to get the dump. I'll have to read the doucmentation to figure our where the dump will go, not sure since this is from a page not in the script. Guess I could make a script just of this page should I need to.

      Thanks again!!

      Will update asap.

      thx,
      Richard
      Ok, I got the dump now, sorry for the delay, hope you did not go away and come back to tell me the correct way or point me in that way...

      bash:# perl index.cgi pg=MyBackOffice do=language_tag_editor view=edit +Tag lngId=151 shell=1 SV = PV(0x76506e8) at 0x6691000 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x7dabbf0 "<form method=\"post\" action=\"http://localhost\" en +ctype=\"multipart/form-data\" name=\"edit_form\">\n<input type=\"hidd +en\" name=\"pg\" value=\"MyBackOffice\" /><input type=\"hidden\" nam +e=\"do\" value=\"language_tag_editor\" /><input type=\"hidden\" name +=\"view\" value=\"saveTag\" /><input type=\"hidden\" name=\"lngId\" +value=\"151\" /><input type=\"hidden\" name=\"r\" value=\"\" /><inp +ut type=\"hidden\" name=\"q\" value=\"\" /><input type=\"hidden\" na +me=\"p\" value=\"\" /><input type=\"hidden\" name=\"timel\" value=\" +1267175109\" />\n\t\t<table border=\"0\" cellpadding=\"2\" cellspaci +ng=\"2\" align=\"center\" width=\"650\">\n\t\t\t<tr>\n\t\t\t\t<td cla +ss=\"td_header_green\" colspan=\"2\">\n\t\t\t\t\tModify a Language Ta +g\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=\"label_ +cell\">\n\t\t\t\t\tLanguage:\n\t\t\t\t</td>\n\t\t\t\t<td class=\"non_ +label_cell\">\n\t\t\t\t\tRussian\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t< +tr>\n\t\t\t\t<td class=\"label_cell\">\n\t\t\t\t\tLast Modified:\n\t\ +t\t\t</td>\n\t\t\t\t<td class=\"non_label_cell\">\n\t\t\t\t\t02/23/10 + 01:24 PM\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class= +\"label_cell\">\n\t\t\t\t\tTag:\n\t\t\t\t</td>\n\t\t\t\t<td class=\"n +on_label_cell\">\n\t\t\t\t\tJoinPage_Final_RegisterButton\n\t\t\t\t</ +td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=\"label_cell_center\" + colspan=\"2\">\n\t\t\t\t\tCurrent Content:\n\t\t\t\t</td>\n\t\t\t</t +r>\n\t\t\t<tr>\n\t\t\t\t<td class=\"non_label_cell_center\" colspan=\ +"2\">\n\t\t\t\t\t???????? - ???????????????? ????\n\t\t\t\t</td>\n\t\ +t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=\"label_cell_center\" colspan +=\"2\">\n\t\t\t\t\tNew Content:\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<t +r>\n\t\t\t\t<td class=\"non_label_cell_center\" colspan=\"2\">\n\t\t\ +t\t\t<textarea name=\"tagvalue\" rows=\"10\" cols=\"85\" onfocus=\"t +his.select()\" class=\"formfield\">???????? - ???????????????? ????</ +textarea>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<t +d class=\"label_cell\" colspan=\"2\">\n\t\t\t\t\tEnglish Version Cont +ent:\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=\"non +_label_cell_center\" colspan=\"2\">\n\t\t\t\t\tI agree - Register Me\ +n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=\"label_ce +ll\">\n\t\t\t\t\tEnglish Version Last Modified:\n\t\t\t\t</td>\n\t\t\ +t\t<td class=\"non_label_cell\">\n\t\t\t\t\t02/22/10 09:36 PM\n\t\t\t +\t</td>\n\t\t\t</tr>\n\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=\"non_l +abel_cell_center\" colspan=\"2\">\n\t\t\t\t\t<input type=\"submit\" n +ame=\"choice\" value=\"Preview Changes\" class=\"submit\" />\n\t\t\t\ +t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form><br /><br />"\0 CUR = 2240 LEN = 2248
      See even in their they are all ??? marks...

      That is what makes me think Perl does not like the cryllic text or something.

      BTW, I tried doing this:
      use open ':utf8'; use utf8;
      that did not do it. Still see just ???? marks in the out put on the page.

      Any ideas now?

      thx,
      Richard
        @ikegami or anyone else, I put the dump on there, do you have any idea why Perl cannot understand or read the cryllic language?

        I have tried quite a few things and cannot find an answer. Hope someone has had the same problem that fixed it so they can point me in the right way.

        thx,
        Richard
        Has anyone seen this dump? See what caused it?

        I'm curious.