JSON not valid after json_encode posts

Newlines are not valid inside json strings. However you are outputting this code or otherwise checking it for sanity is somehow adding newlines into your long strings here. Check that your strings really are all one line and not broken up into multiple lines.

Allowing non-latin characters in registration

Try this (not tested, I hope I am not short circuiting it into endless loop): add_filter(‘sanitize_user’, ‘non_strict_login’, 10, 3); function non_strict_login( $username, $raw_username, $strict ) { if( !$strict ) return $username; return sanitize_user(stripslashes($raw_username), false); }

do_settings_sections() doesn’t escape quotes

I found the problem. You need to escape the values in the _render functions, using esc_attr, like this: function my_setting_render() { $options = get_option(‘my_option_name’); ?><input name=”my_option_name[my_setting]” value=”<?php echo esc_attr($options[‘my_setting’]);?>”> <?php }

WordPress Database Charset/Collate

There are $wpdb->charset and $wpdb->collate. I am not sure if or when one of these values might be empty, so it is better to prepare for empty values … From my DB class: /** * Get table charset and collation. * * @since 2012.10.22 * @return string */ protected static function get_wp_charset_collate() { global $wpdb; … Read more

Add whitespace between Chinese and other letters

Interesting question. This could be a useful part of a specific language file. It cannot be done in CSS, because CSS is (mostly) character agnostic. But using a filter and PHP it is possible and on topic: add_filter( ‘the_content’, ‘t5_chinese_spacing’ ); function t5_chinese_spacing( $content ) { return preg_replace( ‘~([^\p{Han}]*)(\p{Han}+)([^\p{Han}])~imUxu’, ‘\1 \2 \3’, $content ); } … Read more

Character encoding issue after changing servers

After spending the entire day working on this, I finally found a guide that worked perfectly: https://theblogpress.com/blog/seeing-weird-characters-on-blog-how-to-fix-wordpress-character-encoding-latin1-to-utf8/ Before that, I tried following @Rarst’s information, tried exporting the database and manually cleaning it, tried the UTF-8 Sanitize Plugin with a modified version from here http://www.prelovac.com/vladimir/ultimate-solution-to-weird-utf-character-encoding-problem (which actually worked pretty well, but didn’t fix all the characters. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)