We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36926
    • 701 Posts
    After a recent import of an old modx site (0.9.6) into revo 2.2 i've noticed that strange characters appearing within content. Normally next to the £ sign. So for example

    I'll get "£3.9"

    This  character is actually in the DB of the old site and the new one. But is only rendered out in the new set. It's not present in the HTML source of the old site or even modx when you are editing only the DB itself.

    I'm guessing it's something to do with the new site is using utf and the old one was latin. Is there anyway to convert. Could i just do a find a sql find query and replace with an empty string or is there an alternative way.


    Thanks

    Ben
      • 3749
      • 24,544 Posts
      It's likely that the actual data in the tables is still in Latin1. You could do a search-and-replace, but there may be other problems as well.

      See this: http://bobsguides.com/convert-db-utf8.html


      ---------------------------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
      MODX info for everyone: http://bobsguides.com/modx.html
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 36926
        • 701 Posts
        Thanks Bob, your script successfully converted all tables to UTF8 but i'm still seeing that character on the rendered page and it's visible in the content field in manager. If i view the sql files, there's actually a lot more of them that aren't displaying.
          • 3749
          • 24,544 Posts
          The best guess is that someone pasted text from something like MS Word or a crapped up web page.

          It might be easiest to do search-and-replace operations on the .SQL file in a good editor before importing it.


          ---------------------------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
          MODX info for everyone: http://bobsguides.com/modx.html
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 36926
            • 701 Posts
            Yeah you're probably right regarding it being pasted from word. Prob with find an replace is it's picking up 1000s or occurrences even ones that are a problem as they not displayed on the page. For the time being i'm go through the main site and manually amending via the manager. There doesn't seem to be as many pages as i first thought that are effected.

            Thanks again for your help.

            Ben
              • 3749
              • 24,544 Posts
              On second thought, using search-and-replace on the whole .SQL file could be dangerous because you might alter passwords and other data that shouldn't change.

              I think you could, however, export the modx_site_content table and edit that. You could also write your own snippet that would just do the search-and-replace on the content field of all resources. That would be the safest.


              ---------------------------------------------------------------------------------------------------------------
              PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
              MODX info for everyone: http://bobsguides.com/modx.html
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting