Re: problems with utf-8 conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Nathan,

i tried with utf8_encode, that doesn't help. Yes both content-type & metatag are set to utf-8.

When i try utf-8 converted csv everything shows up properly. Issue is when i try to change encoding in php, special characters are messed up.

Character that i am facing problem with is

’ ’ ’ right single quotation mark 
Thanks,
Sudhir



----- Original Message ----
From: Nathan Rixham <nrixham@xxxxxxxxx>
To: sudhir patil <sudhirpatil1@xxxxxxxxxxx>
Cc: php-general@xxxxxxxxxxxxx
Sent: Mon, 5 April, 2010 8:19:54 PM
Subject: Re: problems with utf-8 conversion

sudhir patil wrote:
> I have csv file with special characters, stored in default encoding(ISO-8859-1). I am convert file contents(string) to UTF-8using iconv. This doesn't convert special characters properly, shows broken on fronted. Page encoding & meta tag are properly set to utf-8.
> 
> Characters are shown properly on frontend if i save file encoding as utf-8(Using notepad). But iconv doesn't convert characters properly to UTF-8.
> 
> $value = iconv("Latin1","utf-8", $value);
> having problem with below mentioned character
> 
> ’ ’ &rsquo; right single quotation mark 
> Any idea or suggestions to fix this would be helpful.
> 

1: try utf8_encode instead of iconv
2: check the headers being sent and that they include:
      "Content-Type: text/html; charset=UTF-8"
   as this normally overwrites and choice you make in html.

a good way of debugging this is to view the page in firefox and see menu
option "View -> Charecter Encoding -> xxxx"; the one presently selected
is generally the pages "real" encoding, and you can flick between
iso-8859-1 / utf-8 to see which one "fixes" your problem (then change
headers accordingly).

regards!



      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux