Troubles Displaying Arabic Text - php

I have this website, websiteaddress.com where I'm facing troubles displaying arabic text. Arabic text shows (?????) question marks only.
I had two sessions of chatting with support, but, no result so far.
These options have been tested and didn't solve the issue:
No database connection is actually established for Arabic text. All arabic text is static, no database entries. So, database encoding isn't an issue.
The site is based on wordpress, encoding in settings is set to "UTF-8". Also tried the ISO-8859-1, both gave the same result. (the arabic text doesn't come from the wordpress databse, it's hardcoded within the theme files)
added a default charset to htaccess to UTF-8 as well as ISO-8859-1.
Resent the headers using PHP with UTF-8 encoding and also tried ISO-8859-1.
changed the PHP.INI in my hosting root directory and also under this specific account root directory and changed the encoding from ISO to UTF-8.
So, all the above did not solve the issue.
Also, I have created two testing pages, with exactly the same text inside (in arabic): websiteaddress.com/test.html and websiteaddress.com/test.php .. both were the same pages, I just changed the extensions of the files. The html works fine and displays arabic. The php one doesn't work and displays questions marks.
This is basically the issue.
If anyone has any other option for me to try or know how to go about doing this, please let me know!
I have searched alot on stackoverflow and found alot of solutions, mostly all the above solutions were mentioned in some questions on stackoverflow. But, none of them answered my question, hence the post here..
Thanks and have a great day everyone!

It was solved by my hosting provider, just in case anyone need this. This is their reply:
I checked the php.ini and the changes were not made in there, so I changed them for you. I also edited the following in your php.ini. exif.encode_unicode I set it to UTF-8 and uncommented it. Now the arabic is rendering at: websiteaddress.com/test.php and websiteaddress.com/test.html You can add the following to your .htaccess to get a different php version rendered. The following code is for 5.3. AddType application/x-httpd-php53 .php

Related

Wordpress character encoding issue after upgrade

I have a wordpress site hosted on Heroku using nginx, hhvm and mysql.
I was on WP version 4.1 and then upgraded to 4.4.2. Now I see that some of my posts have weird characters (black diamonds with questions marks that you can see below).
Also, when i log in to the wp-admin and try to edit a post, the post editor is completely blank (both visual and text modes), and the wordcount shows 0. However the actual post content is still displayed on the live page and I see in the DB that the posts still exist.
*I've checked the console and this is not because of a javascript error or any sort of jQuery mismatch
I believe this is some sort of character encoding issue, because when I change the encoding settings in chrome to Western ISO-8859-15 the black diamonds go away. The post editor is still broken though.
I've tried changing the character encoding on the database and on the individual tables, but that did not fix the problem. I wonder if this is related to some internal HHVM setting for character encoding. Have not been able to find anything there to change though.

htaccess php version change & wrong encoding

I'm strugelling with strange problem. My hosting provider do not offer cpanel with PHP config option (i know, disaster). For the purpouses of my website I had to change PHP version from 5.2 to 5.5. So admin told me i can use htaccess and command: AddHandler php5.5-fastcgi php
And ok - it activates proper PHP version, but what is totally strange -> change totally my mysql database encoding. The output is following - all posts, pages etc. which were previously displayed in my native language (polish) right now do not display polish diacritic symbols. I've tried to change the whole database collation to UTF8_general_CI yet it didnt solve the problem. I use wordpress as cms, but the issue appears also in my own cms, as well as plain php with mysql. Any ideas how to change that? thanks!

debug strange characters returned by symfony

I'm not sure how to debug this, or even how best to describe the problem, but all symfony requests are returning strange characters at the beginning of every page. Example:
§{"id":"c8184631","version":0.1}
This should be a json response. Those two characters appear at the beginning of every response no matter the bundle or controller. But only happens on symfony, regular PHP on that server is fine.
This doesn't happen locally. I'm unsure how to start debugging this or even which questions to ask.
Maybe there are some files with different encoding (utf-8 or iso-8859-13), that happened to me before, but I was not using symfony2, just php.
What I did was open every file and changed the file encoding to utf-8.
You can check the encoding for each file for example in "Notepad ++"
Encoding->Convert to UTF-8.
It worked for me.

No images when switching Wordpress site hosts

Here's my problem :
I switched a Wordpress site from HostGator to MediaTemple. Since the domain name stays the same, I backed up and re-imported the database, downloaded and re-uploaded the site content without issues.
The first time, everything worked well except that in place of the images, I could only see question marks. Opening the image in a new tab would show "Not found". I went in the FTP and realized that the file names were in french and with accents in them like "é" and "à", and that in the process of downloading the files to my Mac (Using Coda) and re-uploading them in the server, the accents were all replaced by weird characters...
I tried to manually rename them, it did not work
I tried to do it using different Ftp apps, did not work
I tried using windows to do it, did not work
I managed by playing in Coda's preferences to change the encoding and to re-upload the files to the server while keeping all the accents but it still didn't work...
Database is in UTF-8, and I tried multiple collation like UTF8_bin and general_ci but it didn't work either...
I am pretty sure it is a character encoding issue since there is 1 or 2 images working on the site and they have no accents in their names but I really don't know where to look anymore.
Switched multiple Wordpress websites and never had this problem before, could somebody point me in the right direction please ?
In wordpress all the links are saved into the database and are not hard coded in the html files. So when you're shifting your website from one host to another, you must find and replace the previous host's links with the new host's links in the database file exported from the previous host before importing it into the new host.
Go to the following links for details.
How to Move WordPress From Local Server to Live Site
Moving WordPress - Wordpress Codex
Wish you good luck.
Ask your new hosting service to chown your files to your new account, which may be solve the problem.

Migrate web-pages from different char-sets to UTF-8

For the last years I used Notepad++ on Win XP SP2.
As I just have seen, the setting in Notepad++ is to encode new files in "ANSI" in "Windows Format". Basically all files on my harddisk should be ANSI files then, but I'm not sure.
Most .html-files have a charset-tag as "text/html; charset=iso-8859-1", but some have none.
Other files, especially text-files (for example keyword-lists) I stored with Firefox XPCOM-system, I don't know how they are currently encoded.
On Server-side I have Apache with PHP and MySql.
For Upload I used Filezilla.
Now the problem is: I want to use Japanes signs (or arabic, etc.). This only works partly.
I can get my selfmade Firefox-Application to constantly write or read UTF-8. But I can't check everytime which of the old files is which encoding.
Having just read Joel Spolsky's old article about UTF-8 strengthens my view that I simply have to get my whole system changed as much as possible to UTF-8.
As long as I have it running that way locally on my Hard-Disk I could just re-upload everything to the server.
So: How do I get all my files locally transfered to UTF-8?
And: Is it possible at all to have Win XP SP2 using constantly UTF-8 everywhere? Or do I have to check it with every program, or even worse with every file, that the right encoding is to be used.
How about files I get for example in E-Mails or via an USB-stick, or that I download in zip-files? (Or a thousand possibilities more.)
Update:
1.-4. went OK so far. I tried first with BOM, but without seems to be better.
So to 5.) Something I have to change there too. I changed as in 3.) the charset in the html-template-file, and the text coming from the template is displayed correctly. But the text coming from MySql/Php shows the UnknownChar-sign at some places currently, i.e. where there should be Umlaute äöü.
I have changed all collations for text fields in the MySql-Database via phpmyadmin to "utf8_unicode_ci", but that didn't do the trick.
Is it a php-issue, or do I only have to convert somehow the data in the MySql-Database once?
The beauty of UTF-8 is that it's a superset to ASCII, so if your html and php files only contain Latin alphabets (i.e. English and programing/HTML syntax), you don't need to convert the file at all. You can leave most of your file unchanged.
Should you find few exceptions that you want to convert it manually, you may open them up in Notepad++, and do 'Encoding' - 'Convert to UTF-8 (No BOM)'.
Yes, you do need to change/add <meta> charset tag to all the HTML files to make sure the browser render your files in UTF-8.
In Notepad++ you could set the new file to always open with 'UTF-8 (No BOM), Unix'. Also, check the tick on "Apply to ANSI files" so old file can be correctly saved to the new encoding. I suggest the format is because even though you are working on a Windows machine, the web servers usually runs Linux/BSD so the format is the native form (keeping files in native form is important especially when you are using a version control system).
Migrate a live site with database is a different issue. Data in MySQL comes with their own encoding, and from your question I cannot tell if you need to do it and how to do it. Need more specifics on that (if you need to).

Categories