Jump to content

Recommended Posts

I have a huge body of text in my blog, but the thing is...it contains loads of these little � symbols.

 

I was wondering if anyone knew of a solution to remove them from the text...and they appear after a " character.

 

If anyone could help, that would be nice. Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/172094-the-%EF%BF%BD-symbol/
Share on other sites

This doesn't always work.

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 

I usually force with a header at the top of every script (or common include):

header('Content-Type: text/html; charset=UTF-8');

If you have funny characters in your database you could use mbstring extensions to convert the encoding:

$string = "abc";
print mb_convert_encoding($string, "UTF-8", "auto");

Prior to inserting records in your database run the following query. Best straight after a connection has been established.

mysql_query("SET NAMES UTF8");

Do not attempt to convert characters.

Link to comment
https://forums.phpfreaks.com/topic/172094-the-%EF%BF%BD-symbol/#findComment-907386
Share on other sites

which I copied the text from a text document I had created in word 07

What does the character look like in your database? Microsoft uses non standard encodings. Do you have some sort of javascript HTML editor that you are using to insert your blog content? If so it will be retaining the MS Word formatting. You should paste the text from Word into a text editor first (i.e. notepad) and then copy into your textarea for insert to your blog. Not directly from MS word!

If you are using a javascript editor to insert your blogs such as http://www.fckeditor.net/ there should be a config setting to force pasted content as plain text and not retain formatting (at least this one does). You will never be able to replace characters that have come from MS Word, trust me I have tried.

Link to comment
https://forums.phpfreaks.com/topic/172094-the-%EF%BF%BD-symbol/#findComment-907406
Share on other sites

which I copied the text from a text document I had created in word 07

What does the character look like in your database? Microsoft uses non standard encodings. Do you have some sort of javascript HTML editor that you are using to insert your blog content? If so it will be retaining the MS Word formatting. You should paste the text from Word into a text editor first (i.e. notepad) and then copy into your textarea for insert to your blog. Not directly from MS word!

If you are using a javascript editor to insert your blogs such as http://www.fckeditor.net/ there should be a config setting to force pasted content as plain text and not retain formatting (at least this one does). You will never be able to replace characters that have come from MS Word, trust me I have tried.

I am not using javascript at all in my blog system. I have made it so that it mysql_real_escape_string(htmlentities()); the content befor entering the database.

Link to comment
https://forums.phpfreaks.com/topic/172094-the-%EF%BF%BD-symbol/#findComment-907408
Share on other sites

OK, MS Word is the devils work as far as HTML encoding.

An alternate solution could be to disable the default character encoding in your apache configuration. Look for:

AddDefaultCharset

And comment it out

#AddDefaultCharset

 

Restart apache

Link to comment
https://forums.phpfreaks.com/topic/172094-the-%EF%BF%BD-symbol/#findComment-907420
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.