Jump to content

Special Characters?


Fabbuccino

Recommended Posts

Hey

 

Kinda new to mySQL. I have, in a table, a long piece of text with quotation marks, apostrophes, and new lines. When I echo that piece of text into a php page, the new lines are ignored and the text is just one big block of text and the apostrophes are ignored.

 

Why so? I've tried using "htmlspecialchar" when echoing..no luck. any clue as to why this is happening?

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

New lines are ignored in HTML.  You will have to use nl2br() to convert them to line breaks (<BR>).  The htmlspecialchars() should take care of quotes and other special characters.  So the command would be

echo nl2br(htmlspecialchars($TheString));

  Don't switch the two functions around or you'll get the line breaks as clear text.

 

If that does not work.  Use the "View Source" command in your browser and take a look at what is being sent.  Post that, and some code, and maybe we can help.

Link to comment
https://forums.phpfreaks.com/topic/174725-special-characters/#findComment-920883
Share on other sites

ok thanks. the new lines worked. now i think what my main issue is the fact that i inserted the piece of text in the mySQL database manually and so when trying to convert it back when echoing, it ain't doing that. now, i was able to fix the single quotes through a program i made with visual basic, lol, but i still have an issue with the three dots like this "..." it doesn't accept that..how come?

Link to comment
https://forums.phpfreaks.com/topic/174725-special-characters/#findComment-921015
Share on other sites

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.