$wpdb->get_row not returning UTF-8 encoded results (5 posts)

  1. Baden
    Posted 4 years ago #

    When I use WordPress' recommended method of querying the database $wpdb->get_row($sql) the results are NOT UTF-8 encoded. However, when I run the exact same query manually mysql_fetch_assoc($sql) the results ARE properly UTF-8 encoded.

    To put a finer point on it:
    using $wpdb->get_row($sql) returns:

    using mysql_fetch_assoc($sql) returns:

    Any clue how to have wpdb return UTF-8 encoded results?

  2. Baden
    Posted 4 years ago #

    Bump. The database is utf-8 encoded. There must be something simple I am missing--any help is greatly appreciated.

  3. krembo99
    Posted 4 years ago #

    having the same problem - If anyone have a solution, would be greatly appreciated .

  4. coderguy
    Posted 4 years ago #

    Having the same issue. Did either of you figure it out?

  5. krembo99
    Posted 4 years ago #

    yes, I did resolved it .
    In my case One of the plugins has a filter that was converting the content from "ISO-8859-1" to "UTF-8" (or viceversa, i can not remember)

    Anyhow , to make sure that this would not happen in the future , I used my own filter to run and check that . I used a littele known php funtcion for character converting called mb_convert_encoding(); like so :

    mb_convert_encoding( $content, "ISO-8859-1", "UTF-8");

Topic Closed

This topic has been closed to new replies.

About this Topic