Forum

Thread tagged as: Problem

Weird characters but UTF-8 set?

Hi there

Seem to be having a few issues with weird characters, e.g. https://lovebedford.co.uk/business/what-we-do-for-you.php

"Café Seating BedfordBID saves cafes over £3,000 per year, after driving down the café seating charge from £3,800 to under £500. Café society".

However, this is only appearing on certain pages, and I have <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> in the header so it should prevent that right?

Could something have happened on the server or am I missing something obvious?

Thanks

Rich

Rich Hemery

Rich Hemery 0 points

  • 5 years ago

OK, so I logged into Perch admin and went on the top link page and just clicked 'Save' and now it seems to not have any funny characters. However, I don't really want to go into every news story and have to click Save as it will be quite time consuming!

It seems to affect pages that are older than November 2015 as seen by the news listings:

https://lovebedford.co.uk/news/?page=6

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show me your diagnostic report?

Thanks Drew. I know I'm in the wrong for using /news instead of /blog and it's a really old version of Perch. I do plan on starting from scratch with this site on a new server but wondered if there was a quick fix I could do.


PERCH INFORMATION Perch: 2.3.2 Production mode: Production (100) Installed apps: content (2.3.2), perch_events (1.8), perch_news (3.7.6), perch_backup (1.2) DB driver: MySQLi DB tables: perch2_blog_authors, perch2_blog_categories, perch2_blog_comments, perch2_blog_posts, perch2_blog_posts_to_categories, perch2_blog_posts_to_tags, perch2_blog_tags, perch2_categories, perch2_category_counts, perch2_category_sets, perch2_content_index, perch2_content_items, perch2_content_regions, perch2_events, perch2_events_categories, perch2_events_to_categories, perch2_navigation, perch2_navigation_pages, perch2_news_authors, perch2_news_categories, perch2_news_comments, perch2_news_posts, perch2_news_posts_to_categories, perch2_news_posts_to_tags, perch2_news_tags, perch2_page_templates, perch2_pages, perch2_resource_log, perch2_resource_tags, perch2_resources, perch2_resources_to_tags, perch2_settings, perch2_user_privileges, perch2_user_role_privileges, perch2_user_roles, perch2_users Users: 5 App runtimes: <?php include(PERCH_PATH.'/core/apps/content/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_blog/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_events/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_news/runtime.php'); ?> Scheduled tasks for perch_events: update_category_counts (60 mins) Editor plug-ins: ckeditor, markitup H1: ed2bd9286328caabeb59dcd273f559fd L1: c6ac85417024b91d217d13842cbccf86 headerColour: #000000 content_singlePageEdit: 1 helpURL: siteURL: / hideBranding: 1 content_collapseList: 1 lang: en-gb update_2.3.2: done latest_version: 2.8.15 headerScheme: dark dashboard: 1 content_hideNonEditableRegions: 0 logoPath: /perch/resources/logo.png perch_blog_post_url: /blog/post.php?s={postSlug} perch_blog_slug_format: %Y-%m-%d-{postTitle} perch_blog_akismet_key: perch_blog_max_spam_days: 0 perch_events_detail_url: /events/event.php?event={eventSlug} perch_blog_comment_notify: 0 perch_events_update: 1.8 perch_blog_update: 3.8.2 perch_news_post_url: /news/post.php?s={postSlug} perch_news_update: 3.7.5 perch_news_slug_format: %Y-%m-%d-{postTitle} perch_news_akismet_key: perch_backup_mysqldump_path: perch_news_comment_notify: 0 update_2.8.14: done PERCH_DEVELOPMENT: 10 PERCH_STAGING: 50 PERCH_PRODUCTION: 100 PERCH_DB_USERNAME:xxxx PERCH_DB_SERVER: mysql.flinthosts.co.uk PERCH_DB_DATABASE: xxx PERCH_DB_PREFIX:xxxx PERCH_TZ: UTC PERCH_EMAIL_FROM:xxxx PERCH_EMAIL_FROM_NAME: xxxx PERCH_LOGINPATH: /perch PERCH_PATH: E:\Domains\lovebedford.co.uk\wwwroot\perch PERCH_CORE: E:\Domains\lovebedford.co.uk\wwwroot\perch\core PERCH_RESFILEPATH: E:\Domains\lovebedford.co.uk\wwwroot\perch\resources PERCH_RESPATH: /perch/resources PERCH_HTML5: 1 PERCH_ERROR_MODE: DIE PERCH_DEBUG: PERCH_PREVIEW_ARG: preview PERCH_TEMPLATE_PATH: E:\Domains\lovebedford.co.uk\wwwroot\perch\templates PERCH_DEFAULT_DOC: index.php PERCH_DEFAULT_EXT: .php PERCH_PRODUCTION_MODE: 100 PERCH_RWD: PERCH_AUTH_PLUGIN: PERCH_DB_CHARSET: PERCH_DB_PORT: PERCH_DB_SOCKET: HOSTING SETTINGS PHP: 5.4.14 Zend: 2.4.0 OS: WINNT SAPI: cgi-fcgi Safe mode: not detected MySQL client: mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $ MySQL server: 5.6.26 Extensions: Core, bcmath, calendar, ctype, date, ereg, filter, ftp, hash, iconv, json, mcrypt, SPL, odbc, pcre, Reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, openssl, SimpleXML, wddx, xml, xmlreader, xmlwriter, cgi-fcgi, mysql, mysqli, gd, curl, Phar, mhash GD: Yes ImageMagick: No PHP max upload size: 8M PHP max form post size: 8M PHP memory limit: 128M Total max uploadable file size: 8M Resource folder writeable: Yes Session timeout: 24 minutes Native JSON: Yes Filter functions: Yes Transliteration functions: No PROCESSOR_ARCHITEW6432: AMD64 _FCGI_X_PIPE_: \\.\pipe\IISFCGI-c62aacfd-70b9-4f61-b901-709096202c68 PHP_FCGI_MAX_REQUESTS: 10000 PHPRC: D:\Program Files (x86)\PHP\ ALLUSERSPROFILE: C:\ProgramData APPDATA: C:\Windows\system32\config\systemprofile\AppData\Roaming APP_POOL_CONFIG: C:\inetpub\temp\apppools\lovebedford.co.uk\lovebedford.co.uk.config APP_POOL_ID: lovebedford.co.uk CommonProgramFiles: C:\Program Files (x86)\Common Files CommonProgramFiles(x86): C:\Program Files (x86)\Common Files CommonProgramW6432: C:\Program Files\Common Files COMPUTERNAME: SOLOMON ComSpec: C:\Windows\system32\cmd.exe ESET_OPTIONS: FP_NO_HOST_CHECK: NO LOCALAPPDATA: C:\Windows\system32\config\systemprofile\AppData\Local NUMBER_OF_PROCESSORS: 4 OS: Windows_NT Path: C:\ProgramData\Oracle\Java\javapath;d:\ColdFusion9\verity\k2\_nti40\bin;D:\Program Files (x86)\PHP\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\ESET\ESET File Security\; PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC PROCESSOR_ARCHITECTURE: x86 PROCESSOR_IDENTIFIER: AMD64 Family 21 Model 1 Stepping 2, AuthenticAMD PROCESSOR_LEVEL: 21 PROCESSOR_REVISION: 0102 ProgramData: C:\ProgramData ProgramFiles: C:\Program Files (x86) ProgramFiles(x86): C:\Program Files (x86) ProgramW6432: C:\Program Files PSModulePath: C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ PUBLIC: C:\Users\Public SystemDrive: C: SystemRoot: C:\Windows TEMP: C:\Windows\TEMP TMP: C:\Windows\TEMP USERDOMAIN: WORKGROUP USERNAME: SOLOMON$ USERPROFILE: C:\Windows\system32\config\systemprofile VERITY_CFG: d:\ColdFusion9\verity\k2\common\verity.cfg windir: C:\Windows windows_tracing_flags: 3 windows_tracing_logfile: C:\BVTBin\Tests\installpackage\csilogfile.log ORIG_PATH_INFO: /perch/core/settings/diagnostics/index.php URL: /perch/core/settings/diagnostics/index.php SERVER_SOFTWARE: Microsoft-IIS/7.5 SERVER_PROTOCOL: HTTP/1.1 SERVER_PORT: 80 SERVER_NAME: lovebedford.co.uk SCRIPT_NAME: /perch/core/settings/diagnostics/index.php SCRIPT_FILENAME: e:\domains\lovebedford.co.uk\wwwroot\perch\core\settings\diagnostics\index.php REQUEST_URI: /perch/core/settings/diagnostics/ REQUEST_METHOD: GET REMOTE_PORT: 30236 REMOTE_HOST: xxxxxxx REMOTE_ADDR: xxxxxx PATH_TRANSLATED: e:\domains\lovebedford.co.uk\wwwroot\perch\core\settings\diagnostics\index.php LOCAL_ADDR: xxxxxxxx INSTANCE_META_PATH: /LM/W3SVC/219 INSTANCE_NAME: LOVEBEDFORD.CO.UK INSTANCE_ID: 219 HTTPS: off GATEWAY_INTERFACE: CGI/1.1 DOCUMENT_ROOT: e:\domains\lovebedford.co.uk\wwwroot APPL_PHYSICAL_PATH: e:\domains\lovebedford.co.uk\wwwroot\ APPL_MD_PATH: /LM/W3SVC/219/ROOT IIS_UrlRewriteModule: 7.1.0761.0 HTTP_X_REWRITE_URL: /perch/core/settings/diagnostics/ HTTP_UPGRADE_INSECURE_REQUESTS: 1 HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36 HTTP_REFERER: https://lovebedford.co.uk/perch/core/settings/ HTTP_HOST: lovebedford.co.uk HTTP_COOKIE: PHPSESSID=g9k64avnujggmjpnd5ee4v9pq4; _ga=GA1.3.807614592.1461923039 HTTP_ACCEPT_LANGUAGE: en-GB,en;q=0.8,en-US;q=0.6,fr;q=0.4 HTTP_ACCEPT_ENCODING: gzip, deflate, sdch HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 HTTP_CONNECTION: keep-alive FCGI_ROLE: RESPONDER PHP_SELF: /perch/core/settings/diagnostics/index.php REQUEST_TIME_FLOAT: 1464343201.5375 REQUEST_TIME: 1464343201

I contacted my host and they said the following:

I can't see how it can be server related - if it were all pages would show the same, that was why I suggested the database - each story I assume has an entry in a table, wasn't sure if that table has somehow got the wrong collation - or has the data for these stories been added in a different way?
As it looks like your links are built from a common file /news/post.php the only place you should need to define the meta is in 'post.php'.

Looking again at the database 'lovebedford' (which is under the studiohem domain) I can the characters in the database, so it looks like this has happened as the data has been added to the db. 
You can see this under the db 'lovebedford' table 'perch2_news_posts' PostID 44 is correct, ID 46 is incorrect. 
The collation does not appear to be set in the database.
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you at some point exported and reimported the database? If that was done without respect to the encoding, it could have screwed it up.

Additionally, your pages aren't being served wit a UTF8 header. If you were on a current version of Perch we'd be doing this for you, but you can force it yourself:

<?php
header('Content-Type: text/html; charset=utf-8');
?>

Be sure to do that before any HTML is output.

Hi Drew

No I've never exported/imported the db.

Thanks for the above code, I've added it to the headers but doesn't seem to have changed anything.

It is weird how it's only affecting certain news stories and only in the title not the body of the story.

I'm just going to go in the news stories and re-save them manually but I'll leave this thread up here as someone else may come across it in the future.

Thanks