Jump to content

how to convert character

- - - - -

  • Please log in to reply
2 replies to this topic

#1
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
hi guys

i find this character in a page: Elaz-#305;-#287;spor
what is -#305;and -#287; ?

this full name in show page is: Elazigspor

but how to change Elaz-#305;-#287;spor to Elazigspor with PHP?

page is Czech language and i nee change to english

help please

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
They're HTML entity encoded. The name is really elaz-ı-ğspor.

You will have to use the html_entity_decode function to decode it in to a compliant string (i.e. UTF-8 or however you have set up the charset)

I believe after you do this, you can pass it to one of PHP's iconv extension functions to translate it in to US-ASCII (i.e. ğ->g)
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
thank you, i'll now in html entity decode page

but i cant found a good function

i found this:
$input = "Elazığspor";


$output = preg_replace_callback("/(&#[0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, $input);


echo $output; 

but i need better

and for this string Paraná - Náutico ø, æ, å i need a good iconv or mb_convert_encoding for convert to english character

i find this
mb_convert_encoding("Paraná - Náutico ø, æ, å", "UTF-8", "KOI8-R");

but i need better


please help me

thank you




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users