Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Nov 2014
    Posts
    4
    Plugin Contributions
    0

    Default Character sets mismatch after changing hosts

    Hello,

    I have a problem with a ZEN cart site of one of our customers.
    After migrating it to our servers, some characters (like the €-sign) are corrupted.
    I think it's a mismatch in the character set, but I'm not sure on how to fix this.

    For example when I create a coupon code with a €-sign in the couponcode field, I get a SQL error.
    The customer states this worked at the previous server.
    This is the error thrown (this is an update, but a create ends in the same error).

    1366 Incorrect string value: '\x8050' for column 'coupon_code' at row 1
    in:
    [update coupons set coupon_code = '€50', coupon_amount = '10.0000', coupon_type = 'P', uses_per_coupon = '0', uses_per_user = '1', coupon_minimum_order = '0', restrict_to_products = '', restrict_to_categories = '', coupon_start_date = '2014-11-06', coupon_expire_date = '2015-11-06', date_created = now(), date_modified = now(), coupon_zone_restriction = '0' where coupon_id='12']

  2. #2
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Character sets mismatch

    Does this help?

    http://www.zen-cart.com/content.php?...8859-1-to-utf8

    Cheers
    RodG

    Oh scrub that. You said you migrated, and this is only relevant if you upgraded. How did you export the original data? It look like it has been hex encoded. You may need to re-export the data from the original site and re-import it.
    Last edited by RodG; 6 Nov 2014 at 06:16 PM.

  3. #3
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Character sets mismatch

    It probably still is a problem with importing data based on a certain character set into a server which either doesn't support that character set or collation.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Nov 2014
    Posts
    4
    Plugin Contributions
    0

    Default Re: Character sets mismatch

    Thank you for your replies.
    Can you tell me how to check that and how I can fix it?

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Character sets mismatch

    Quote Originally Posted by sanderh View Post
    Thank you for your replies.
    Can you tell me how to check that and how I can fix it?
    Hopefully DrByte has a suggestion how to fix the problem if it is related to the import.

    I'm working from the 'other end' and am thinking that the problem is/was caused during the export of the original data, in which case re-exporting without the HEX encoding would be my suggestion.

    What program/software did you use for the export/import anyway? Most folk tend to use phpMyAdmin which in my experience doesn't usually cause an issue like this.

    Cheers
    RodG

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,477
    Plugin Contributions
    88

    Default Re: Character sets mismatch

    One other thing to look at: When you created the database using your new webhost's cPanel, what collation did you specify on the database-create request?

  7. #7
    Join Date
    Nov 2014
    Posts
    4
    Plugin Contributions
    0

    Default Re: Character sets mismatch

    Hi, I exported the data from the other host, using phpmyadmin.
    And I imported the data using HeidiSQL.
    I cannot do this again, because the site is already in use on the new server.
    Orders will disapear, so I have to fix this on the current server.

    The charset on the OLD database was utf8_general_ci
    The charset on the NEW database is also utf8_general_ci.

    However the tables have latin1_swedish_ci, on both servers...

    Does this make any sense to you guys?
    Can webserver software be the cause of this?
    I think the old server ran on LINUX/Apache, while the new one is WINDOWS/IIS

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,477
    Plugin Contributions
    88

    Default Re: Character sets mismatch

    You could use the Convert db2utf8 plugin (http://www.zen-cart.com/downloads.php?do=file&id=1318), which will automatically convert those latin1_swedish_ci tables to utf8_general_ci. Be sure to place your site into maintenance mode and make a database backup before you run the script (just to be sure).

  9. #9
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Character sets mismatch

    Quote Originally Posted by sanderh View Post
    The charset on the OLD database was utf8_general_ci
    The charset on the NEW database is also utf8_general_ci.
    However the tables have latin1_swedish_ci, on both servers...
    Interesting. Since the Database and the Tables are the same on both I wouldn't really be expecting you to be having the problems that you have.

    What version of Zencart are you using?
    Did you try to perform a ZenCart update at the same time as the migration?

    Also, in your 1st post you wrote
    "After migrating it to our servers, some characters (like the €-sign) are corrupted."
    and
    "For example when I create a coupon code with a €-sign in the couponcode field, I get a SQL error."

    Can you verify that these are two different (albeit related) issues.

    Issue#1) The €-sign is 'corrupted' in the pre-existing data that was imported (in what way is this particular symbol corrupted?). and
    Issue#2) You can no longer enter data that contains the €-sign

    Quote Originally Posted by sanderh View Post
    Can webserver software be the cause of this?
    The WEB server, no. A Webserver has nothing to do with SQL.

    Can the SQL server be the cause.. Yes, most certainly, especially if the data was originally stored in a MySQL server and you are trying to import it into an MSSQL or MariaDB server, etc...

    There can even be issues exporting/importing into different versions of the same SQL server

    Quote Originally Posted by sanderh View Post
    I think the old server ran on LINUX/Apache, while the new one is WINDOWS/IIS
    The WebServer is irrelevant. The fact that you have downgraded to Windows based services *may* be relevant, but at the end of the day it is the DB server that is of most importance. A MySQL server on a Linux based machine generally doesn't behave any differently than the same version of a MySQL server running on a Windows based machine.

    I suspect that a part (or all) of your problem relates to the fact that you exported with phpmyadmin, but imported with HeidiSQL.

    Quote Originally Posted by sanderh View Post

    I cannot do this again, because the site is already in use on the new server.
    Orders will disapear, so I have to fix this on the current server.
    Yoiks. This has somewhat limited your options, and a fix may not even be *easily* possible

    I have just three suggestions for you. None of which I'm very confident about, so before trying either make sure you backup your database first.

    Suggestion#1
    Download and run this:
    http://www.zen-cart.com/downloads.php?do=file&id=1318

    Keep your fingers crossed. I've no idea what to expect if all of your tables and data get converted to UTF8 if your ZenCart version is still using LATIN1

    Suggestion#2.
    Export the data to a CSV file, load this file into a spreadsheet and use the Search-Replace functions to 'fix' the 'corruptions', then re-import the modified CSV.

    The 3rd option would be to hire a database expert to see if they can restore things back to a sane condition. Databases can be very unforgiving, and if you don't fully understand what you are doing you can end up making a bad situation worse.

    Don't forget the cardinal rule though... MAKE A BACKUP (and ideally you should test that you can restore from this backup *before* doing anything else). It's no good having a backup if you don't know how to use it to restore.

    I wish you the best of luck. I think you are going to need it.

    CHeers
    RodG

  10. #10
    Join Date
    Nov 2014
    Posts
    4
    Plugin Contributions
    0

    Default Re: Character sets mismatch

    Hi,

    Thank you all for your responses.
    I think I have managed to solve it!
    I had to do 2 steps:
    1) convert the database using the suggested tool. http://www.zen-cart.com/downloads.php?do=file&id=1318
    2) convert my v1.3.9 site PHP files to utf-8 using this guide: https://www.numinix.com/blog/2011/08...-3-9-to-utf-8/

    I hope all is resolved, my customer is checking it now, if there are further questions, I will come back!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v139h Email problem after changing hosts
    By dbjsi83474 in forum Installing on a Linux/Unix Server
    Replies: 3
    Last Post: 5 May 2012, 04:48 AM
  2. sessions error after changing hosts
    By delia in forum General Questions
    Replies: 6
    Last Post: 29 Jul 2011, 08:47 PM
  3. Greek character sets
    By andreasy in forum General Questions
    Replies: 2
    Last Post: 18 Jul 2011, 07:20 AM
  4. URL problems after changing hosts
    By richmwi in forum General Questions
    Replies: 2
    Last Post: 9 Oct 2009, 02:18 AM
  5. Non-English character sets
    By rpguk in forum General Questions
    Replies: 0
    Last Post: 25 Feb 2007, 06:16 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR