开发者

Need to remove ASCII character

开发者 https://www.devze.com 2023-01-05 20:59 出处:网络
I\'m pulling some text from a database, which contains some carriage returns. When I put them s开发者_开发问答traight into html, they get interpreted as � .I\'ve tried a bunch of different ways to re

I'm pulling some text from a database, which contains some carriage returns. When I put them s开发者_开发问答traight into html, they get interpreted as � . I've tried a bunch of different ways to remove them, but haven't seemed to have any luck.

Any thoughts?


It sounds like character encoding conflicts. Other previous suggestions are fine for a quick fix, but if you control the data I think you'd be better off figuring out and sticking to a single character set. If you read from a UTF-8 database and include that text on a website, don't tell the browser that you're serving ISO-8859-1 or Windows-1252.


select Replace(myColumn,CHAR(13),'')

Have you tried this? What else have you tried?


Well, if you want to keep the carriage returns, use nl2br otherwise use $val = str_replace(array('\r\n', '\r', '\n'), ' ', $val);

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号