Syntax error, unexpected ‘class’ (T_CLASS) on line 1 after upgrade to php 5.6.4

After upgrading to php 5.6.4 my widgets file causes: Parse error: syntax error, unexpected ‘class’ (T_CLASS) in /home/path/fss-widgets.php on line 1 I’m mystified – several hours research has yielded nothing. The problem doesn’t appear to be quoting, escaping, or anything else you would expect in this situation and the code looks ok to me. <?php … Read more

How to stop WordPress using utf8mb4_unicode_520_ci collation?

Recently I’ve installed PHP7 on my MAMP and updated to newest version of WordPress. Every time I do a new site all my tables are using collation utf8mb4_unicode_520_ci I have tried setting define(‘DB_COLLATE’, ‘utf8_general_ci’); in my wp-config.php which worked fine until Gravity Forms ignored it and created all it’s tables in utf8mb4_unicode_520_ci I’ve seen that … Read more

What is the difference between UTF-8 and Unicode?

I have heard conflicting opinions from people – according to the Wikipedia UTF-8 page. They are the same thing, aren’t they? Can someone clarify? 18 s 18 Let me use an example to illustrate this topic: A Chinese character: 汉 its Unicode value: U+6C49 convert 6C49 to binary: 01101100 01001001 Nothing magical so far, it’s … Read more

Encode text string being appended as query to URL [closed]

Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for WordPress Development Stack Exchange. Closed 3 years ago. Improve this question I have a shortcode in use at present that embeds a button on selected product pages. Upon clicking this button, the … Read more

What is the best collation to use for MySQL with PHP? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago. Improve this question I’m wondering if there is a “best” choice for collation in MySQL for a general website … Read more

Java URL encoding of query string parameters

Say I have a URL http://example.com/query?q= and I have a query entered by the user such as: random word £500 bank $ I want the result to be a properly encoded URL: http://example.com/query?q=random%20word%20%A3500%20bank%20%24 What’s the best way to achieve this? I tried URLEncoder and creating URI/URL objects but none of them come out quite right. … Read more

Strange characters – despite everything being UTF-8

Not sure why this thread was closed, but this is the same issue inflicting many people. All my WP config settings are in order: //define(‘DB_CHARSET’, ‘utf8’); //define(‘DB_CHARSET’, ‘utf8_unicode_ci’); //define(‘DB_COLLATE’, ”); I even tried enabling them one by one. None worked. When I save a post, weird characters appear in place of apostrophes and spaces. This … Read more

Converting string to byte array in C#

I’m converting something from VB into C#. Having a problem with the syntax of this statement: if ((searchResult.Properties[“user”].Count > 0)) { profile.User = System.Text.Encoding.UTF8.GetString(searchResult.Properties[“user”][0]); } I then see the following errors: Argument 1: cannot convert from ‘object’ to ‘byte[]’ The best overloaded method match for ‘System.Text.Encoding.GetString(byte[])’ has some invalid arguments I tried to fix the … Read more