problems with utf-8 conversion

=0AI 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 encod=
ing & meta tag are properly set to utf-8.=0A=0ACharacters are shown properl=
y on frontend if i save file encoding as utf-8(Using notepad). But iconv do=
esn't convert characters properly to UTF-8.=0A=0A$value =3D iconv("Latin1",=
"utf-8", $value);=0Ahaving problem with below mentioned character=0A=0A=E2=
=80=99 ’ ’ right single quotation mark =0AAny idea or suggestio=
ns to fix this would be helpful.=0A=0AThanks in advance,=0ASudhir=0A=0A=0A=
=0A Your Mail works best with the New Yahoo Optimized IE8. Get it NOW!=
http://downloads.yahoo.com/in/internetexplorer/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
sudhir patil [ Mo, 05 April 2010 16:09 ] [ ID #2037821 ]

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
>
> ’ ’ ’ 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!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Rixham [ Mo, 05 April 2010 16:49 ] [ ID #2037823 ]

Re: problems with utf-8 conversion

Thanks Nathan,=0A=0Ai tried with utf8_encode, that doesn't help. Yes both c=
ontent-type & metatag are set to utf-8.=0A=0AWhen i try utf-8 converted csv=
everything shows up properly. Issue is when i try to change encoding in ph=
p, special characters are messed up.=0A=0ACharacter that i am facing proble=
m with is=0A=0A=E2=80=99 ’ ’ right single quotation mark =0ATha=
nks,=0ASudhir=0A=0A=0A=0A----- Original Message ----=0AFrom: Nathan Rixham =
<nrixham [at] gmail.com>=0ATo: sudhir patil <sudhirpatil1 [at] yahoo.co.in>=0ACc: php=
-general [at] lists.php.net=0ASent: Mon, 5 April, 2010 8:19:54 PM=0ASubject: Re:=
problems with utf-8 conversion=0A=0Asudhir patil wrote:=0A> I have csv fil=
e with special characters, stored in default encoding(ISO-8859-1). I am con=
vert file contents(string) to UTF-8using iconv. This doesn't convert specia=
l characters properly, shows broken on fronted. Page encoding & meta tag ar=
e properly set to utf-8.=0A> =0A> 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.=0A> =0A> $value =3D iconv("Latin1","utf-8", =
$value);=0A> having problem with below mentioned character=0A> =0A> =E2=80=
=99 =E2=80=99 ’ right single quotation mark =0A> Any idea or suggesti=
ons to fix this would be helpful.=0A> =0A=0A1: try utf8_encode instead of i=
conv=0A2: check the headers being sent and that they include:=0A "Cont=
ent-Type: text/html; charset=3DUTF-8"=0A as this normally overwrites and =
choice you make in html.=0A=0Aa good way of debugging this is to view the p=
age in firefox and see menu=0Aoption "View -> Charecter Encoding -> xxxx"; =
the one presently selected=0Ais generally the pages "real" encoding, and yo=
u can flick between=0Aiso-8859-1 / utf-8 to see which one "fixes" your prob=
lem (then change=0Aheaders accordingly).=0A=0Aregards!=0A=0A=0A=0A 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
sudhir patil [ Mo, 05 April 2010 17:08 ] [ ID #2037824 ]

Re: problems with utf-8 conversion

I found lot of poeple having matters with chars over 1 byte, so I've
published that : http://www.phpcs.com/codes/ENCODAGE-UTF16_51501.aspx

If you take a look, give me a feedback please (to apis [at] apieum.com)

regards,
greg

Le 05/04/2010 17:08, sudhir patil a écrit :
> 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
>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Apis SARL [ Di, 06 April 2010 10:42 ] [ ID #2037879 ]
PHP » gmane.comp.php.general » problems with utf-8 conversion

Vorheriges Thema: Updating HTML on page
Nächstes Thema: include path in httpd.conf