JS API character encoding in Matrix 5


(Jamie Smith) #1

We're experiencing an issue using the JS API to update an asset's HTML content in Matrix v5.1.2.1. It's working fine in 4.14.1.

 

This is the call that updates a Standard Page's contents (asset 123456 is of type WYSIWYG Content Type):

js_api.setAttribute({
    "asset_id": 123456,
    "attr_name": "html",
    "attr_val": "<p>Question mark?</p>",
    "dataCallback": function (data) {
        console.log(data); // Returns 'Attribute "html" has been successfully set to "<p>Question mark%3F</p>" for Asset "DIV Content" (#123456)'
    }
});

The API sends the data as "<p>Question mark %3F</p>" as per version 4, but the encoded "%3F" character isn't being converted back into "?".

 

Does anyone know what might be causing the issue? Is there something we need to check on our Matrix 5 installation?

 

Any suggestions appreciated. Thanks.


(Anthony Ponomarenko) #2

Hi there,

 

This issue was resolved in 5.1.4.2 https://squizmap.squiz.net/matrix/6224 

 

Note from the report:

 

When we changed to JSON encoding in Matrix 5.1, there are a number of places in the JS API which no longer need their API data cleaned, now they are not being sent as form data.

Symptoms of this include the characters "#", "&", "?" and "+" being URL-encoded.


(Jamie Smith) #3

Hi there,

 

This issue was resolved in 5.1.4.2 https://squizmap.squiz.net/matrix/6224 

 

Many thanks, Anthony.