Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 707165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:14:49+00:00 2026-05-14T04:14:49+00:00

For some convoluted reasons best left behind us, I require direct access the contents

  • 0

For some convoluted reasons best left behind us, I require direct access the contents of a WordPress database. I’m using MySQL 5.0.70-r1 on Gentoo with WordPress 2.6, and Perl 5.8.8 ftr.

So, sometimes we get high-order characters in the blog, we have quite a few authors contributing too, for the most part these characters end up in WordPress’s database in wp_posts.post_content or wp_postmeta.meta_value, WordPress is displaying these correctly on its site, but the database stores it using single byte encoding that I can’t figure out how to convert to the correct string. Today’s example:

The blog shows this, and doesn’t even seem to escape any chars in the HTML,

   Hãhãhães  

but the database, when viewed via the MySQL prompt, has,

   Hãhãhães

So clearly this is some kind of double-byte encoding issue, but I don’t know how I can correct it. I need to be able to pull that second string from the database (because that’s what it gives me) and convert it to the first one, and I need to do so using Perl.

Also, just to help unmuddy any waters, I took these strings and printed out the ASCII codes for each character using Perl’s ord() function.

Here is the output of the “wrong” string:

H = 72
à = 195
£ = 163
h = 104
à = 195
£ = 163
h = 104
à = 195
£ = 163
e = 101
s = 115

This is the correct string, that I need to produce in my script:

H = 72
ã = 227
h = 104
ã = 227
h = 104
ã = 227
e = 101
s = 115
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:14:50+00:00Added an answer on May 14, 2026 at 4:14 am

    I fixed it… Thanks to those who read and/or tried.

    my $dbh = DBI->connect('mysql:etc:etc');
    $dbh->{mysql_enable_utf8}++;  #<---- solution
    

    That’s all, sigh…

    Not sure about the MySQL prompt thing, because I don’t really care, but I’m sure it’s a similar solution, to make sure MySQL is returning results in double-bytes to its prompt. Though see my comment above, “set character_set_*” variables didn’t seem to affect it though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Some application we're using depends on TComponent descendants to easily save/load the state of
Some one asked about How to connect to SQL server database from JavaScript? and
I was reading some code that a consultant provided us. It's a bit convoluted,
I guess if it is possible, that it will be some crazy convoluted way,
I'm using some code to enable me to render rotated text with the TextRenderer.DrawText
I've got an HTTPModule that does some role-based page access security (I'm having to
I'd like to perform some convoluted variation of the @a = @b || @c
I'm working with legacy code that uses some convoluted logic to bind IN and
I have some code creating a QTabWidget from Python using PyQt4. I want to
My database is MS SQL 2008. Im basically merging some sets of data together

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.