Jump to content

PHP, FileMaker & Special Characters


spacemonkey

Recommended Posts

I am trying to pass the contents of a user completed text field in FileMaker Pro 9 (- the FileMaker database is being served from Macosx 10.5.5 as is the PHP server (- same machine)) the (using Open URL script step) to a variable in the receiving send_message.php file. The text is transmitted and received, however, the user generated text includes 'smart quotes' (“ and ”) and consequently appear as “ and †respectively (-note the hidden character after the †for the ”).

 

I have tried using the following code to no avail:

 

$oldmsgString = "“";
$newmsgString = "\"";
$test_message =  stripslashes($_GET['message']);
$new_message =  str_replace($oldmsgString, $newmsgString, $test_message);

 

Interestingly when I pasted the code directly from the send_message.php file into this post it appeared as:

 

$oldmsgString = "“";
$newmsgString = "\"";
$test_message =  stripslashes($_GET['message']);
$new_message =  str_replace($oldmsgString, $newmsgString, $test_message);

 

n.B. the content of the $oldmsgString.

 

It would appear to be an issue to do with the text encoding in FileMaker and PHP but I have no idea how to resolve this. Is there a way I can convert the text received from the FileMaker text encoding to that expected by PHP?

 

Any help would be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/135629-php-filemaker-special-characters/
Share on other sites

This is a real pain in the arse. Usually get this when people copy and paste text directly from microsoft word into a html text editor that saves into a database table. Never really found a solution, tested changing character sets and all kinds but nothing works completely.

 

The problem using str_replace with a string like "“" is that php doesn't actually see the characters in that fashion. They only come out like that when printed to the screen.

 

Hopefully somebody has the answer

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.