Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2010
    Posts
    900
    Plugin Contributions
    0

    Default Weird Characters - Need an SQL solution!

    NOTE: Mod, please don't move this to the EP4 support page! I don't think it has anything to do with EP4. I was able to duplicate the problem by manually dropping code into new products. Same thing happened, with or without EP4.


    Hi!

    I recently uploaded about 1000 products using EasyPopulate 4.0 and hundreds of the products showed up with 'markup' types of weird characters.

    To figure out what was going on, I picked a product, navigated to it in Admin, then clicked on SOURCE VIEW. Unable to find anything queer, I hit PREVIEW, then UPDATE. Low and behold, it fixed itself!

    I repeated this several times, each time fixing all problems on every product I tried.

    Here is an example of a PROBLEM:
    Use ESD Shielding bags to follow ANSI/ESD S20.20 fundamental ESD control principle: Transportation of ESDS items outside an Electrostatic Protected Area requires enclosure in static protective materials; low charging and static discharge shielding materials are recommended.

    This is what it looks like after I UPDATE:
    Use ESD Shielding bags to follow ANSI/ESD S20.20 fundamental ESD control principle: Transportation of ESDS items outside an Electrostatic Protected Area requires enclosure in static protective materials; low charging and static discharge shielding materials are recommended.

    MY QUESTION:
    Is there a way to automate the UPDATE process with an SQL command I can just drop in the SQL Query Executor?

    It would take me all day to go thru Admin, click on each product and hit Preview, then Update.

    Any help would be greatly appreciated!
    ~Mike

  2. #2
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Weird Characters - Need an SQL solution!

    Some programs (such as Microsoft Office) like to assume you want "smart quotes", "em-dashes", etc and will automatically "correct" your text replacing the characters you typed with these. The easiest fix is to either disable "auto-correct" for these in MS Office (or whatever program you are copying the text from) or use a program which does not "auto-correct" these characters.

    CKEditor and similiar tools have added detection to "replace" these characters. When you open the product / catalog page using the admin interface the characters were probably replaced with html entities, encoded the character for your charset, or replaced with a plain ".

    When working with Excel and exporting to CSV... Once again one needs to either disable "auto-correct" (and replace any characters excel has already "auto-corrected") or sanitize the exported document by replacing "smart quotes", "em-dashes", etc (after export). Then when you "import" the CSV to your database the characters will turn out as expected.
    Last edited by lhungil; 28 May 2013 at 05:24 PM. Reason: clarification
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhngl : Plugin / Module Tracker

  3. #3
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Weird Characters - Need an SQL solution!

    So to answer your question... You could either adjust the CSV files and re-import (which should fix all the products)... Or take a peek at Replacing Smart Quotes and Em-Dashes in Mysql. I have not used those instructions, but they appear plausible.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhngl : Plugin / Module Tracker

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

    Default Re: Weird Characters - Need an SQL solution!

    Quote Originally Posted by Feznizzle View Post
    MY QUESTION:
    Is there a way to automate the UPDATE process with an SQL command I can just drop in the SQL Query Executor?

    It would take me all day to go thru Admin, click on each product and hit Preview, then Update.

    Any help would be greatly appreciated!
    ~Mike
    Sorry Mike, but the answer is no.

    lhungil said pretty much the same thing, possibly without realising it.

    This is what I think is happening:

    Quote Originally Posted by lhungil
    CKEditor and similiar tools have added detection to "replace" these characters. When you open the product / catalog page using the admin interface the characters were probably replaced with html entities, encoded the character for your charset, or replaced with a plain ".
    In other words, it is the CKeditor that is doing the actual 'fixing', therefore MySQL and its 'update' command can't be of much help in this regard.

    I've no doubt that there is a way to do this entirely with SQL (leaving CKeditor out of the picture) but it would probably be best/easiest to fix the data via other means (such as exporting to CSV, doing a search replace, then re-importing).

    Cheers
    Rod

  5. #5
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Weird Characters - Need an SQL solution!

    It really depends on where your bad data came from in the first place.

    And the "fixing" that you say is happening might be triggered by cleaners in ckeditor, if that's what you've added as an editor, or it might be merely some built-in cleaners in Zen Cart that are cleaning it.

    Of course, the best fix is to start with clean data. And it looks like your data is from a different character set ... and when you save it via your store admin is getting converted to the character set used by your store.
    So, fixing the source data to be in the correct character set would stop the problem at the outset. If your data, which you're importing from some external source, is bad, then this isn't really even a Zen Cart issue.
    .

    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.

  6. #6
    Join Date
    Apr 2010
    Posts
    900
    Plugin Contributions
    0

    Default Re: Weird Characters - Need an SQL solution!

    Thanks for the input you guys.

    This data came direct from a manufacturer. It was like pulling teeth to get them to get it to me, so I'm kind of stuck with it. I've been using OpenOffice and TextWrangler for editing.

    Looks like I'll go back to TextWrangler forums and try to find a way to detect/replace all special characters.

    I totally forgot about ckeditor, that is indeed what I use. Man, I wish there was a way to simply trigger those filters on the entire db!

  7. #7
    Join Date
    Aug 2009
    Posts
    368
    Plugin Contributions
    0

    Default Re: Weird Characters - Need an SQL solution!

    UPDATE yourtable SET yourcolumn = replace(yourcolumn,"€œ","\"");

    ?

  8. #8
    Join Date
    Apr 2010
    Posts
    900
    Plugin Contributions
    0

    Default Re: Weird Characters - Need an SQL solution!

    Hi Solo,

    Thanks for the suggestion, but it's too late for me to try. I already went thru and did some simple find and replaces to take care of it.

    If it happens again, I'll be sure to try it!

    Thanks,
    Mike

  9. #9
    Join Date
    May 2013
    Posts
    38
    Plugin Contributions
    0

    Default Re: Weird Characters - Need an SQL solution!

    For anyone else that might have this issue, here is a good link about the wrong character encoding in a MySQL database:

    detecting utf8 broken characters in mysql

  10. #10
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Weird Characters - Need an SQL solution!

    Quote Originally Posted by allthingsidLeroy View Post
    For anyone else that might have this issue, here is a good link about the wrong character encoding in a MySQL database:

    detecting utf8 broken characters in mysql
    There's a whole lotta conflicting info in that post. And some of it will lead to problems. Some of it is a waste of time. Some of it is useful. It all depends on the original data and what's been done already to try mangling it.
    My point: As with anything, use at your own risk. Be sure to make solid backups if you're going to go randomly trying those things!
    .

    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.

 

 

Similar Threads

  1. Weird characters on pages
    By sparktronic in forum General Questions
    Replies: 1
    Last Post: 24 Nov 2015, 12:34 AM
  2. Weird characters on admin screen
    By infocom in forum General Questions
    Replies: 5
    Last Post: 15 Oct 2010, 07:59 PM
  3. Weird characters on top page
    By _killer_ in forum General Questions
    Replies: 3
    Last Post: 8 Mar 2010, 03:45 AM
  4. Weird Characters in menu?
    By BodyJewels in forum Customization from the Admin
    Replies: 2
    Last Post: 5 Feb 2009, 02:49 AM
  5. Weird Characters appearing on top of page: 
    By rternier in forum General Questions
    Replies: 4
    Last Post: 25 Jul 2008, 09:56 AM

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