Viewed   67 times

I'm using CURL to import some code. However, in french, all the characters come out funny. For example: Bonjour ...

I don't have access to change anything on the imported code. Is there anything I can do my side to fix this?

Thanks

 Answers

2

Like Jon Skeet pointed it's difficult to understand your situation, however if you have access only to final text, you can try to use iconv for changing text encoding.

I.e.

$text = iconv("Windows-1252","UTF-8",$text);

I've had similar issue time ago (with Italian language and special chars) and I've solved it in this way.

Try different combination (UTF-8, ISO-8859-1, Windows-1252).

Thursday, November 17, 2022
 
1lann
 
5

None of these will allow you to compile PHP with cURL enabled.

In order to compile with cURL, you need libcurl header files (.h files). They are usually found in /usr/include/curl. They generally are bundled in a separate development package.

Per example, to install libcurl in Ubuntu:

sudo apt-get install libcurl4-gnutls-dev

Or CentOS:

sudo yum install curl-devel

Then you can just do:

./configure --with-curl # other options...

If you compile cURL manually, you can specify the path to the files without the lib or include suffix. (e.g.: /usr/local if cURL headers are in /usr/local/include/curl).

Saturday, November 19, 2022
 
2

I use this:

function replaceSpecial($str){
$chunked = str_split($str,1);
$str = ""; 
foreach($chunked as $chunk){
    $num = ord($chunk);
    // Remove non-ascii & non html characters
    if ($num >= 32 && $num <= 123){
            $str.=$chunk;
    }
}   
return $str;
} 
Friday, October 14, 2022
 
4

You need to use 'SET NAMES utf8' to ensure your server sends results back using the UTF-8 character set. Example:

$dbconn = mysql_connect("localhost", "user", "pass") or die(mysql_error());
           mysql_select_db('database', $dbconn) or die(mysql_error());
           mysql_query("SET NAMES 'utf8'");
Wednesday, November 16, 2022
1

Using UTF-8 is just fine, but here is few checkpoints.

If you are using MySQL, set database/tables/fields collations in utf8_unicode_ci

and If you are using php, do mysql_query('SET NAMES utf8'); before query

and in HTML output use

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
Friday, December 9, 2022
 
shinnok
 
1

A coworker informed me that this curl php.ini setting was not added until PHP 5.3.7: http://www.php.net/manual/en/curl.configuration.php#ini.curl.cainfo

The particular test server I was working with was running an older version than that, so PHP wasn't reading that setting from php.ini.

Thursday, October 6, 2022
 
dt.
 
dt.
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :