![]() |
| Domain Name Sales | Domain Software | Calculate UK Domain Drop Dates | Domain Registration | NameDrive | Domain Parking | Subscribe to our Domains For Sale newsletter |
| | ||||||
| Home | Register | Rules | Membership Upgrade | Domains For Sale | Domain Name Escrow | Mark Forums Read | Domain Classified | Chat Room |
| Scripts and Coding PHP, MySQL, scripts |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) | |
![]() | uft-8 encoding question
Really starnge problem that I'm having: I've different pages some with Japanese, some with French characters (never mixed - either 1 or the other) Different parts of the pages are displaying the characters correctly and in other parts, some of the characters are replaced with ??? or ??? in diamonds. I have this in the head (which is actually a php included file): Quote:
I think because it's an included file theres an issue with the server default encoding taking over and messing up havf of the characters... Just not sure if it is a server encoding issue and why only half of the characters are affected Has anyone experienced anything like this?
__________________ Connect with me @ TW:LI:FB | MyWeb | D/L domains4sale | Morecambe London Student Forums Student Books UK promotions agencies | |
| |
| | #2 (permalink) |
![]() |
Are you sure you havent inserted incorrectly encoded data into the database or have the database encoding set differently than the output encoding ? One common issue I see alot is people who have wrote their content on Microsoft word and the strange characters magically appearing that Microshaft call smart quotes.
__________________ Browse: |
| |
| | #3 (permalink) | ||
![]() |
The text isn't from a database. In places it's an echo'ed variable, other places its straight text. The problem seems to happen when the page in question gets its header from an included file: Quote:
Quote:
Really odd. I'm waiting for a reply from support
__________________ Connect with me @ TW:LI:FB | MyWeb | D/L domains4sale | Morecambe London Student Forums Student Books UK promotions agencies | ||
| |
| | #4 (permalink) | |
![]() |
Yep, this is exactly what's happening (what I mentioned above) - really odd. Quote:
If I put it in the header.php file and then load the page which includes the header, it shows perfectly. If I put it in the index.php (which includes the header.php file <- this includes the encoding information) then the Japanese displays as ????? So I need to either get the server default to be UTF-8 or load my headers sooner (before the file include)
__________________ Connect with me @ TW:LI:FB | MyWeb | D/L domains4sale | Morecambe London Student Forums Student Books UK promotions agencies | |
| |
| | #5 (permalink) |
![]() |
Perhaps you're not saving the main file in UTF-8 format from the text editor, or whatever you used to make it? If you save it in ASCII or another format, it could turn out like you posted.
__________________ Memorable Domains Ltd - Over 7,000 descriptive, generic .co.uk domains for sale Please note: All sale prices over a week old are automatically invalid. No exceptions. Thanks! |
| |
| | #6 (permalink) | |
![]() |
Thanks for your help Edwin and Skinner - appreciate it. Edwin I don't think that the issue is how I'm saving it because if I use the same file editor and save in the same way I can get a success and a failur depending on if the Japanese goes in the header (where the encoding is specified) or in the index (where the encoding info is php included in a header). So I'm sure it's that the included file's encoding instruction is ignored if the Japanese (or French for that matter) is located in the index file (and not in the header). I made some progress with my host. They gave me a php.ini file on my server. I see the following in the file: Quote:
If I remove the ";" my french and german pages output correctly, but the Japanese goes even crazier. I tried making the default_charset = "UTF-8" but the french, german and japanese are all displayed with errors. There may be more things I need to change in the php.ini but this issue seems to be a bigger problem in general. Not sure if it's limited to my hosts setup, or if it's a php problem that encoding info isn't transfered when the page header is part of a php include.
__________________ Connect with me @ TW:LI:FB | MyWeb | D/L domains4sale | Morecambe London Student Forums Student Books UK promotions agencies | |
| |
| | #7 (permalink) |
![]() |
have you tried editting the page header, not the include the actual apache header ? header('Content-type: text/html; charset=utf-8');
__________________ Browse: |
| |
| | #8 (permalink) | |
![]() |
Skinner & Edwin - thanks for your help - I've now kinda fixed the problem (just have other issues Edwin you were right about how the file was saved. I was assuming that a language pack that came with some software would have the French/German/Japanese files saved as UTF-8 - but they weren't ![]() Also my server needed the php.ini settings had to be tweaked. Was wondering if you knew about preg_replace and safely displaying Japanese characters on a page. Quote:
I'm using code like this to only allow a-z, french accented characters and spaces, other characters translated to a space. 1. Is this a safe way to go about this? Or can quotes and other characters still get through? 2. What do I need to put in there to allow Japanese characters (Kanji I think)? And will it be safe or open up the risk or quotes and other code getting through? Really appreciate your help. Skinner you always try and answer my coding questions and Edwin you spurred me to double checking the language file encoding on this - thanks again.
__________________ Connect with me @ TW:LI:FB | MyWeb | D/L domains4sale | Morecambe London Student Forums Student Books UK promotions agencies | |
| |
| | #9 (permalink) |
![]() |
You would be better using graphics made with GD or ImageMagick to display the Kanji. You can make quotes etc safe using the htmlentities() functions, which converts < > into > / < and " into "e; stuff like that. Stops nasties being added in. There is also utf8_encode and utf8_decode that may help too. My RegEx sucks major ass but I'm pretty sure you need to add \i to make it case insensitive, otherwise your only going to match lowercase letters
__________________ Browse: |
| |
| | #10 (permalink) |
![]() |
I saw this Character list on another website of what you need to allow ÀàÁáÂâÃãÄäÅ寿ÇçÈèÉéÊêËëÌìÍíÎîÏïÐðÑñÒòÓóÔôÕõÖöØøÙù ÚúÛûÜüÝýÞþœŒ
__________________ Browse: |
| |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Domain Name Community | Replies | Last Post |
| A question from buy.at | Tyson Pearcey | Affiliate Marketing | 21 | 05-02-2008 03:26:35 PM |
| 123-Reg noddy question | bb99 | Domain Name Registrars | 3 | 20-02-2007 01:59:18 PM |
| Google Network & Parking Programs Question? | sneezycheese | Internet Marketing | 0 | 08-10-2006 10:35:58 AM |
| Question about DRS etc | Brassneck | Domain Name Disputes | 2 | 10-10-2005 05:13:34 PM |
