Tag Archives: utf-8

UTF-8 problem when saving to mysql

Questions: My website is using charset iso 8859 1 <meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ /> when user post chinese character, it will be saved into the database as & # 2 0 3 2 0 ; & # 2 2 9 0 9 ; which will output as the chinese character when retrieved. I need to… Read More »

Why when add <?xml version=“1.0” encoding=“utf-8”?> to web page don´t work on hosting?

Questions: I am developing a simple webpage at hostgator.com. I have the standard headers, but when I add the following line: <?xml version=”1.0″ encoding=”utf-8″?> the page does not work. I would like why. This is the full header: <?xml version=”1.0″ encoding=”utf-8″?> <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1 /DTD/xhtml1-strict.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml” lang=”es” xml:lang=”es”> …… Read More »

content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'

Questions: I’ve been trying for a long time to send right request to soap server. I’m keep getting error message. Here is my xml GET LAST REQUEST (newlines added): <?xml version=”1.0″ encoding=”UTF-8″?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:ns1=”http://tempuri.org/”> <SOAP-ENV:Body><ns1:TestData1><ns1:iVal>1</ns1:iVal></ns1:TestData1></SOAP-ENV:Body> </SOAP-ENV:Envelope> GET LAST RESPONSE : REQUEST HEADERS: POST /DPWebService/CardsService.svc/ICardsService HTTP/1.1 Host: d67v7tg1 Connection: Keep-Alive User-Agent: PHP-SOAP/5.2.9-1 Content-Type: text/xml; charset=utf-8… Read More »

Working with GD ( imagettftext() ) and UTF-8 characters

Questions: Just for the record – my first question here but hopefully not my last input in the community. But that’s not why I’m here. I’m currently developing a simple system that has to generate an image with a text on it. Everthing went well until I realised that GD cannot handle UTF-8 characters like… Read More »

How to save Russian characters in a UTF-8 encoded file

Questions: OK so I have a PHP file with several strings of text in various languages. For most languages like French or Spanish I just simply type in the characters. The problem I have is with Russian language characters. The PHP file is encoded in UTF-8, how can I make sure that the Russian characters… Read More »

Migrating a php application to handle UTF-8

Questions: I am working on a multi-language app in php. All was fine until recently I was asked to support Chinese characters. The actions I took to support UTF-8 characters are the following: All DB tables are now UTF-8 HTML templates contain the tag <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ /> The controllers send out a header… Read More »

How to save a JSON as unescaped UTF-8 in PHP 5.3?

Questions: I created a JSON file: $json = array( “Sample” =>array( “context” => $context, “date” => $date ) ); $url= “sample.json”; $myfile = fopen($url, “w”) or die(“Unable to open file!”); fwrite($myfile, json_encode($json)); fclose($myfile); I need to save it as UTF-8 and I can’t use JSON_UNESCAPED_UNICODE in PHP 5.3. So what should I do now? Answers: