Hi,

I'm taking texts from other page. In my page I use utf-8 encoding. When I print texts in my page, I get � for some symbols, for example for ö in German, or è in French.
I tried use file_get_contents, curl, but in these two ways output have � symbols.

$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,"$path");
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl_handle,CURLOPT_ENCODING,"");
curl_setopt($curl_handle,CURLOPT_HEADER,1);
$results = curl_exec($curl_handle);
curl_close($curl_handle);

In output I use xhtml for mobile (I'm creating WAP page):

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />....

Also header:

header('Content-type: application/xhtml+xml; charset=utf-8');

Maybe You can help me to get texts without � symbols in correct encoding?

P.S.Sorry for bad English.

If you know the encoding of the page you're getting, than you could use iconv() to translate.

Thanks for Your help! ;) Problem solved.

Thanks for Your help! ;) Problem solved.

Hey man, would you tell me how you resolved your problem with wrong character set in curl_setopt? I have the same issue with weird characters and cannot find the way to encoded into proper format.

Thanks and appreciate
Jan

Hey man, would you tell me how you resolved your problem with wrong character set in curl_setopt? I have the same issue with weird characters and cannot find the way to encoded into proper format.

Thanks and appreciate
Jan

Hi,

I can't remember what I was coding then, but I used iconv function as pritaeas mentioned. I used UTF-8 as out_charset, but can't remember in_charset.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.