Mysql PHP, Retrived string contains apostrphone cant replace

user7432810

I have some records on my table and as I can see it on PHPMyAdmin it contains apostrophe like this:

Brazil’s ‘car wash’ 

When I make a query and echo them on web page without any header these apostrophes appear as question marks like this:

Brazil�s �car wash� 

but with this header:

header("Content-Type: text/html; charset=ISO-8859-1");

they appear correctly.

Now the problem, I cannot replace them using this code:

$title = str_replace('’',"",$title);
$title = str_replace("‘","",$title);

How can I replace those apostrophes if str_replace not working?

Alex2php

This indicates your data is stored in ISO encoding, while the default encoding of your webpage might be UTF-8 or something else. Why replace them? You could convert your data to UTF-8 prior outputting or change the whole site encoding to ISO. But I would always prefer UTF-8.

You can convert to UTF-8 with $title = utf8_encode($title).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

php variable contains string and replace

From Dev

how to replace number in a string that contains brackets in php

From Dev

pass retrived data to limit mysql

From Dev

Cant select field name in MySQL that contains an asterisk

From Dev

Cant echo php echo as a string

From Dev

Replace string that contains dynamically numbers

From Dev

replace a word that contains a string in powershell

From Dev

mysql php query string contains words that start with input

From Dev

MySQL and PHP search for a string in a table but replace another string

From Dev

PHP - If URL contains string

From Dev

PHP - If string contains '<' or '>' - strpos()

From Dev

Cant retrieve mysql data into a single string

From Dev

php mysql cant find id if there is letters inside

From Dev

why i cant access mysql using php?

From Dev

Cant Send Value To PHP String With AJAX

From Dev

How to replace return carriage in json string made from mysql and php?

From Dev

String replace PHP from a TEXT field within MySQL

From Dev

how to replace string that contains a variable, the next string that contains variables

From Dev

How do I search for a substring with a variable within a string and replace it with content that contains the substring variable with PHP?

From Dev

Cant seem to match Exact string with Preg_replace

From Dev

Php contains mysql which contains IN condition

From Java

MySQL string replace

From Dev

MySQL replace part of string

From Dev

MySQL replace part of string

From Dev

How can I detect string variable contains mysql_query string in PHP?

From Dev

How can I detect string variable contains mysql_query string in PHP?

From Dev

How to replace strings in MySQL that contains backslashes

From Dev

replace a line that contains a string with special characters

From Dev

Regex replace with string that contains a character from the origianal

Related Related

  1. 1

    php variable contains string and replace

  2. 2

    how to replace number in a string that contains brackets in php

  3. 3

    pass retrived data to limit mysql

  4. 4

    Cant select field name in MySQL that contains an asterisk

  5. 5

    Cant echo php echo as a string

  6. 6

    Replace string that contains dynamically numbers

  7. 7

    replace a word that contains a string in powershell

  8. 8

    mysql php query string contains words that start with input

  9. 9

    MySQL and PHP search for a string in a table but replace another string

  10. 10

    PHP - If URL contains string

  11. 11

    PHP - If string contains '<' or '>' - strpos()

  12. 12

    Cant retrieve mysql data into a single string

  13. 13

    php mysql cant find id if there is letters inside

  14. 14

    why i cant access mysql using php?

  15. 15

    Cant Send Value To PHP String With AJAX

  16. 16

    How to replace return carriage in json string made from mysql and php?

  17. 17

    String replace PHP from a TEXT field within MySQL

  18. 18

    how to replace string that contains a variable, the next string that contains variables

  19. 19

    How do I search for a substring with a variable within a string and replace it with content that contains the substring variable with PHP?

  20. 20

    Cant seem to match Exact string with Preg_replace

  21. 21

    Php contains mysql which contains IN condition

  22. 22

    MySQL string replace

  23. 23

    MySQL replace part of string

  24. 24

    MySQL replace part of string

  25. 25

    How can I detect string variable contains mysql_query string in PHP?

  26. 26

    How can I detect string variable contains mysql_query string in PHP?

  27. 27

    How to replace strings in MySQL that contains backslashes

  28. 28

    replace a line that contains a string with special characters

  29. 29

    Regex replace with string that contains a character from the origianal

HotTag

Archive