Welcome Guest, Not a member yet? Register   Sign In
Different type of double quote
#1

[eluser]FutureKing[/eluser]
Hi,

Check this image: http://img213.imageshack.us/img213/2576/convert.jpg

I have a string which has characters shown in left side of image.
I want to convert them into characters that are shown in right side of image.

I tried str_replace but it didn't worked.

I am confused with two types of single and double quotes.

Please help
#2

[eluser]theprodigy[/eluser]
have you tried preg_replace?
#3

[eluser]FutureKing[/eluser]
I tried SQL's REPLACE function, PHP's str_replace and preg_replace function. But none of them are replacing the string.

SQL's REPLACE replaces the string when I run it on MSSQL Management Studio. But when I use it in PHP it does not replaces the character.
#4

[eluser]theprodigy[/eluser]
is this for user submitted items or is this going to be a 1 time deal and then it's over with?

If it's just a one time deal, it may be more beneficial just to go in by hand and change the entries in the database (depending on how many you have). If it's going to be rendering on user submitted content, you may want to replace them before even sending it to the database in the first place

try something like:
Code:
$new_str = preg_replace(chr(8220), '"', $this->input->post('field_name'));
$new_str = preg_replace(chr(8221), '"', $this->input->post('field_name'));

That should get rid of the double quotes. I haven't found which character the slanted single quote is, but it shouldn't be too hard to find.
#5

[eluser]theprodigy[/eluser]
try 8216 and 8217 for the single quotes. Not exactly sure, but worth a try




Theme © iAndrew 2016 - Forum software by © MyBB