Christian Mayne
Christian Mayne

Reputation: 1749

WordPress loading javascript with strange character set

I'm using WordPress 5.1 with Yoast SEO. Yoast SEO relies on the file components.js which is throwing the following error in the console (I've edited this for brevity - it's a very long string)

Uncaught SyntaxError: Invalid regular expression: 
/[A-Za-zªµºÀ-ÖØ-öø-ƺƻƼ-Æ¿Ç€-ǃDŽ-ʓʔʕ-ʯʰ-ʸʻ-ËË-Ë‘Ë -ˤˮͰ-ͳͶ-ͷͺͻ-ͽͿΆΈ-ΊΌΎ-Î

The identical string does not appear in the file, though the file does include the following line when looking with a text editor:

["+"A-Za-zªµºÀ-ÖØ-öø-ƺƻƼ-Æ¿Ç€-ǃDŽ-ʓʔʕ-ʯʰ-ʸʻ-ËË-Ë‘Ë -ˤˮͰ-ͳͶ-ͷͺÍ

The line looks like this when looking through the webhost control panel:

["+"A-Za-zªµºÀ-ÖØ-öø-ƺƻƼ-ƿǀ-ǃDŽ-ʓʔʕ-ʯʰ-ʸʻ-ˁː-ˑˠ-ˤˮͰ-ͳͶ-ͷͺͻ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҂Ҋ-ԯԱ-Ֆՙ՚-՟ա-և։ःऄ-हऻ

The only odd thing is that the database had a mix of character sets (latin1, utf8 and utf8mb4) which I have attempted to fix and all tables now use utf8mb4_uncode_ci (this was chosen as it was the most common character set in the db).

There is also a mix of InnoDB and MyISAM table types. The site has a number of  characters around the site which is a common indicator of character set issues as far as I can tell.

So I'm guessing for some reason WordPress is loading the javascript file with the incorrect character set which is creating errors.

Is there a way to fix this? I'm a bit baffled.

Upvotes: 0

Views: 197

Answers (1)

Christian Mayne
Christian Mayne

Reputation: 1749

Fixed.

This was due to blog_charset being set to UTF-7 in wp_options. Changing this to UTF-8 has solved the problem

Upvotes: 1

Related Questions