• Resolved bep_11

    (@bep_11)


    Hello,
    entered a text field label in Japanese – and it doesn’t get saved properly.

    /**
    * @param null $Id
    * @return bool
    */
    public function save( $Id = null )
    {
    global $wpdb;

    $key = static::$primaryKey;

    $data = $this->prepareSaveData( $Id );
    $da = $data[‘Label’];
    error_log(“BP key: $key data: $da – Id: $Id”,0);

    Error_LOG:
    2019-03-02 21:33:34: (mod_fastcgi.c.2543) FastCGI-stderr: BP-prepareSavedData
    2019-03-02 21:33:34: (mod_fastcgi.c.2543) FastCGI-stderr: BP key: Id data: [:en]Name[:ja]名前[:] – Id:
    2019-03-02 21:33:34: (mod_fastcgi.c.2543) FastCGI-stderr: BP record updated, key: Id

    We clearly see the English/Japanese Label.
    Now the database:

    Database View:

    MariaDB [C00002A01]> select Id,Label from f1_GDFormFields;
    +—-+—————————-+
    | Id | Label |
    +—-+—————————-+
    | 12 | First Name |
    | 13 | Last Name |
    | 14 | Payment |
    | 15 | Start Date |
    | 17 | Email Address |
    | 20 | Send |
    | 21 | Company Name |
    | 23 | Requested Web System |
    | 24 | Selectbox |
    | 27 | First Name |
    | 28 | Last Name |
    | 29 | Requested Web System |
    | 32 | Domain |
    | 35 | Send |
    | 36 | Company Name |
    | 38 | Payment |
    | 39 | Start Date |
    | 40 | Domain Already Registered? |
    | 53 | Submit |
    | 54 | [:en]Name[:ja]??[:] |
    | 55 | Email |
    | 56 | Message |
    | 57 | Captcha |
    +—-+—————————-+
    23 rows in set (0.00 sec)

    Only “??” in the database….
    BTW, it works with other plugins.
    Can you help?

    BTW,
    this code will cause problems with other (non-alphabetical) languages:

    public function getLabel()
    {
    if (!empty($this->Label)) {
    return wp_unslash($this->Label);
    } else {
    // return ucfirst($this->Type->getName());
    // bp 20190302
    return $this->Type->getName();
    }
    }
    -> ucfirst will cripple double-byte text.

    Best regards,
    Bernard

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bep_11

    (@bep_11)

    This problem has been solved.
    The encoding for the plugin database tables had been set to Latin1.
    However, I installed the Japanese version of WordPress and the encoding for all the other tables was correctly set to UTF8….
    You may want to check the encoding of main database tables and then setting the encoding accordingly.

    Plugin Author grandwp

    (@grandwp)

    Dear @bep_11 ,

    Glad to hear you have fixed it.
    Our plugin code doesn’t have encoding, so it takes the default from the server.
    If any help needed, let me know.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problems with Japanese (UTF-8)’ is closed to new replies.