WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: WP-Table Reloaded] Encoding problem when importing table (12 posts)

  1. maorb
    Member
    Posted 4 years ago #

    Hi,

    Thanks for the new version 1.7.
    I try to import a csv file which has Hebrew content in it.
    After importing, all the Hebrew text become Jibrish , only numbers and English characters are ok.
    I assume it's something with encoding to utf-8 with how the plugin works.

    Is there a fix for that that can be implemented?

    p.s - I still haven't finished translating the plugin to Hebrew, hope to finish it soon.

    Thanks,
    Maor

  2. TobiasBg
    Member
    Posted 4 years ago #

    Hi,

    yes, this is definitely an encoding problem, but unfortunately, I have not yet found a solution to it. There are other people (also with uncommen characters in their languages, like Czech or Japanese) that report the same problem.
    I just don't know how to fix it though, as I'm no expert for character encoding :-(
    It might be worth to try a few different encodings of the CSV file, maybe.

    Best wishes,
    Tobias

  3. maorb
    Member
    Posted 4 years ago #

    Please tell me where in the plugin's code (which files and line numbers) is the importing and converting a csv functions.
    I'm not an encoding expert either, but I might figure out something in the code and try to fix that.

  4. TobiasBg
    Member
    Posted 4 years ago #

    Hi,

    that should be the files
    import.class.php
    (which does have a few lines dealing with encoding that I tried a while ago, without real success)
    and parsecsv.class.php
    (which is an external library I use for CSV import),
    both in the "classes" folder.

    Thanks for looking into it!

    Best wishes,
    Tobias

  5. maorb
    Member
    Posted 4 years ago #

    Well, I looked in the parsecsv.class.php, tried to change in lines 127-128 the input/output encoding to utf-8 , still didn't help.

    But then I went to my csv file and opened it with notepad and the re-saved it in utf-8. I t appears that the csv that MS-Excel made was in ANSI encoding.

    After re-saving the csv in utf-8 format, the import seems to be working fine with Hebrew characters.

  6. TobiasBg
    Member
    Posted 4 years ago #

    Hi,

    yes, that's something that has worked for me before, too, but not in all cases.
    Of course it would be nice to somehow have this automatic, so that the import script can detect the encoding and transform it as necessary...

    Best wishes,
    Tobias

  7. tank4girl
    Member
    Posted 3 years ago #

    Any luck with the encoding issue?
    I have a table with utf8 encoding, but some of the characters show, some dont (I get question-marks and such).

    I tried opening the csv in notepad++ and resaving as txt and with utf8 encoding (and without BOM) but still nothing.
    The preview of the table looks perfect, but as soon as I import it it gets mixed up.

    I am really desperate since I am making a website for a big client(a hotel) and have to make it perfect.

    Please help!

  8. TobiasBg
    Member
    Posted 3 years ago #

    Hi,

    unfortunately not, sorry :-(

    The only workaround that works for almost all people is to manually enter characters that make problems into the text fields as then the tables are saved correctly.
    Unfortunately, this is more work than importing a table, but with that copy and paste it at least works...

    Regards,
    Tobias

  9. tank4girl
    Member
    Posted 3 years ago #

    Hi,

    even that doesn't work for me... when I try to type in data by hand the characters also turn into question-marks! Could it be a problem with the cufon font replacement?

    Thanks,
    tank

  10. TobiasBg
    Member
    Posted 3 years ago #

    Hi,

    that could be a possibility. But that would mean that your table actually does show up on the page (just with broken characters). Is that the case? From the context of this thread I figured that the entire table was broken after an import. But not that you mention cufon and after re-reading your post, your problem seems to be unrelated to the previous posts in the thread.
    Your problem might be rather simple: The font you have chosen in cufon could not contain all characters that you want, like special accents and so on. Can you try without cufon?

    Regards,
    Tobias

  11. rafff
    Member
    Posted 3 years ago #

    In wp-table-install.php

    Add CHARACTER SET to sql query like that:

    $sql = "CREATE TABLE ".$table_name." (
    table_aid MEDIUMINT(10) NOT NULL AUTO_INCREMENT,
    table_name VARCHAR(200) DEFAULT 'Table name' NOT NULL,
    description MEDIUMTEXT NOT NULL,
    alternative TINYINT(1) DEFAULT '1' NOT NULL,
    show_name TINYINT(1) DEFAULT '1' NOT NULL,
    show_desc TINYINT(1) DEFAULT '0' NOT NULL,
    head_bold TINYINT(1) DEFAULT '1' NOT NULL,
    UNIQUE KEY id (table_aid),
    PRIMARY KEY (table_aid)
    ) DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_polish_ci;";`

    You must deleted previouns tables and than activate plugin again toinstal this correctly or add ALTER CHARSET query in ex phpmyadmin

  12. TobiasBg
    Member
    Posted 3 years ago #

    Hi rafff,

    thanks a lot for this code!

    Unfortunately, this won't help with WP-Table Reloaded as this is a different plugin as wp-Table for which your code is valid.
    WP-Table Reloaded does not use own database tables, so this solution can not be applied unfortunately.

    Best wishes,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Topic