We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36763
    • 70 Posts
    Hi all,

    Firstly, I apologise that this will be a long post.

    I hate writing/finding things like this, and I don't know if it's me, or something weird I've done, or a character encoding problem either at the DB level, the localhost, apache, whatever.

    Today I discovered something that has taken me a few hours to diagnose and find what is causing the problem, yet I'm still not sure why or what it is.

    Firstly, I'll set up my scenario. Most of which is probably irrelevant, but I'm adding it just in case. I have developed a site (still am) and I did it on my other computer - a Mac running Mavericks - nothing special, and I'm running a MAMP environment.
    I have the site in GIT so I can keep control and all that, and have it on different computers. It's on my laptop right now (macpro mavericks, mamp, same as other etc).

    Yesterday I some virtual hosts running.
    So now I can call the web site via http://pakybaps.dev:8888 and the site shows. I changed the config files to reflect this change, instead of the http://localhost:8888.

    Today, I went to try the same site again and used the manager. Now, in the past, I'd copied content from the old site, to this new site. Simple, copy, Paste. In the web view of the site, I get upside down Question marks (we've all seen them before, which could be just a character encoding for the page).

    So, today, going to the http://pakybap.dev:8888/manager I open a page to edit and I get nothing.

    However, using FireBug, I get the follow error:


    SyntaxError: expected expression, got ','
    	,publish_document: "1"
    
    http://pakybaps.dev:8888/manager/?a=resource/update&id=46
    
    


    On this code:


    <script type="text/javascript">
            // <![CDATA[
            MODx.config.publish_document = "1";
            MODx.onDocFormRender = "";
            MODx.ctx = "web";
            Ext.onReady(function() {
                MODx.load({
                    xtype: "modx-page-resource-update"
                    ,resource: "6"
                    ,record: 
                    ,publish_document: "1"
                    ,preview_url: "http://pakybaps.dev:8888/index.php?id=6"
                    ,locked: 0
                    ,lockedText: ""
                    ,canSave: 1
                    ,canEdit: 1
                    ,canCreate: 1
                    ,canCreateRoot: 1
                    ,canDuplicate: 1
                    ,canDelete: 1
                    ,show_tvs: 0
                    ,mode: "update"
                });
            });
            // ]]>
            </script>


    However for a correct version of this script, where it works, the entry should look like this:

            <script type="text/javascript">
            // <![CDATA[
            MODx.config.publish_document = "1";
            MODx.onDocFormRender = "";
            MODx.ctx = "web";
            Ext.onReady(function() {
                MODx.load({
                    xtype: "modx-page-resource-update"
                    ,resource: "10"
                    ,record: {"id":10,"type":"document","contentType":"text\/html","pagetitle":"I'm New","longtitle":"","description":"","alias":"im-new","link_attributes":"","published":true,"pub_date":0,"unpub_date":0,"parent":9,"isfolder":false,"introtext":"","content":"<p>Hi, ","richtext":true,"template":3,"menuindex":0,"searchable":true,"cacheable":false,"createdby":1,"createdon":"2015-07-08 22:14:41","editedby":1,"editedon":"2015-08-15 13:15:05","deleted":false,"deletedon":0,"deletedby":0,"publishedon":"2015-07-08 22:14:00","publishedby":1,"menutitle":"","donthit":false,"privateweb":false,"privatemgr":false,"content_dispo":0,"hidemenu":false,"class_key":"modDocument","context_key":"web","content_type":1,"uri":"","uri_override":false,"hide_children_in_tree":0,"show_in_tree":1,"properties":null,"syncsite":true,"parent_pagetitle":"Welcome","resourceGroups":[],"create_resource_token":"55ceaf672a4538.25271134"}
                    ,publish_document: "1"
                    ,preview_url: "http://pakybaps.dev:8888/index.php?id=10"
                    ,locked: 0
                    ,lockedText: ""
                    ,canSave: 1
                    ,canEdit: 1
                    ,canCreate: 1
                    ,canCreateRoot: 1
                    ,canDuplicate: 1
                    ,canDelete: 1
                    ,show_tvs: 0
                    ,mode: "update"
                });
            });
            // ]]>
            </script>




    As you can see, in the first entry, it's missing the "record" entry. How? Why? I don't know.



    This is a partial record, where I believe thing are going wrong:

    The apostropes are not a typical one.



    <p>To see every person’s gift, ministries and callings identified, endorsed and fully pursued.</p>
    
    <p>To see every person’s daily sphere of influence recognised as a very important ministry of the church.</p>
    
    <p>To foster a vision in each person for the proclamation of the Gospel and the extension of God’s Kingdom.</p>
    
    <p><b>History</b></p>
    <p>
    Pakenham Baptist Church started as a church plant from Beaconsfield Baptist in May 1996.
    Pastor Fred Rudd was Pastoring both Church’s.


    (See the attachment for the web rendering)

    So, after deleting this text from the database, the record came back and I could once again edit it.

    So, here's my thing, is there something in the DB engine that needs to be tweaked for people like me that copy and paste from old sites?

    This does it on Firefox and Safari. I'm also running the latest version: MODX Revolution 2.3.5-pl (traditional)

    How can I correct it without editing the DB manually?

    This question has been answered by sottwell. See the first response.

    [ed. note: vrdriver last edited this post 11 years, 1 month ago.]
      • 4172
      • 5,888 Posts
      check your tables, if everything is utf8
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
      • discuss.answer
        • 28042 ☆ A M B ☆
        • 24,524 Posts
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 36763
          • 70 Posts
          Righto, I'll take a good look at this option. I did notice that I'm in the latin1_swedish_ci type. I've never really had this issue before, so thanks for the pointers. I'll let you know how I go.
            • 36763
            • 70 Posts
            love you guys. smiley That worked. thanks.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Yeah, most C-Panel hosting leaves it at the default swedish_ci (MySQL was developed in Sweden), and after you create the database you have to go into phpMyAdmin and change the collation. It's easy to forget, or even to not be aware of at all. http://modxcookbook.com/installation/database/database-wrong-charset.html
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org