mgPePe
mgPePe

Reputation: 5907

PHP: dealing with quotes, escaping etc in string manipulation

I am making a certain class with complicated string manipulations.

Stuff works well with ' and ". However one of the texts had some weird quotes at an angle like this: and and in my code, the appear as †rather than actual quotes. That breakes my code, since its multiple characters, where it shouldn't have been.

Can somebody please explain why this is happening, and how do you work it around?

Upvotes: 0

Views: 173

Answers (2)

Your Common Sense
Your Common Sense

Reputation: 157828

either use utf-8 encoding or replace all non-fitting characters.
these quotes has no spechial meaning though, you can ignore them.

as it was discovered in the comments, the problem was in using substr instead of mb_substr(). So, with the latter the problem solved.

Upvotes: 1

Trey
Trey

Reputation: 394

Im pretty sure this can be solved by adding <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> in the header. This is caused because it can't read the “. Or you could just change it to normal "

Upvotes: 0

Related Questions