0
Replacing non-ascii characters in String

/t5/coldfusion-discussions/replacing-non-ascii-characters-in-string/td-p/983904
May 15, 2008
May 15, 2008
Copy link to clipboard
Copied
I have a site where the user enters data in a rich text
editor (ktml4) that gets stored into a database (mysql). There are
non ascii characters getting into the data, I'm assuming that they
are copying and pasting from Word. Unfortunately in this situation,
changing that process isn't an option.
Currently, this is the only character that is causing me problems: http://www.zvon.org/other/charSearch/PHP/search.php?request=ffa0&searchType=3
I would just like to replace the non-ascii characters with a space when I read them from the database. Something like:
#Replace(result.column, '\xffa0', ' ')#
However, I believe that code looks for the string "\xffa0", not the character \xffa0.
Is there anyway to do this?
Currently, this is the only character that is causing me problems: http://www.zvon.org/other/charSearch/PHP/search.php?request=ffa0&searchType=3
I would just like to replace the non-ascii characters with a space when I read them from the database. Something like:
#Replace(result.column, '\xffa0', ' ')#
However, I believe that code looks for the string "\xffa0", not the character \xffa0.
Is there anyway to do this?
TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/replacing-non-ascii-characters-in-string/m-p/983905#M89752
May 15, 2008
May 15, 2008
Copy link to clipboard
Copied
rereplace might work.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/replacing-non-ascii-characters-in-string/m-p/983906#M89753
May 15, 2008
May 15, 2008
Copy link to clipboard
Copied
quote:
Originally posted by: Dan Bracuk
rereplace might work.
Can you give an example of how to pass a non-ascii character to REReplace?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/replacing-non-ascii-characters-in-string/m-p/983907#M89754
May 15, 2008
May 15, 2008
Copy link to clipboard
Copied
quote:
Originally posted by: BuckLemke
quote:
Originally posted by: Dan Bracuk
rereplace might work.
Can you give an example of how to pass a non-ascii character to REReplace?
Regular expressions are not my strength, but the approach I was considering was, "if it's not an ascii character, make it a space". Then you pass the entire string at once.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Advisor
,
/t5/coldfusion-discussions/replacing-non-ascii-characters-in-string/m-p/983908#M89755
May 16, 2008
May 16, 2008
Copy link to clipboard
Copied
This blog entry may help you.
http://ipggi.wordpress.com/2008/03/11/remove-or-clean-high-extended-ascii-characters-in-coldfusion-f...
http://ipggi.wordpress.com/2008/03/11/remove-or-clean-high-extended-ascii-characters-in-coldfusion-f...
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/coldfusion-discussions/replacing-non-ascii-characters-in-string/m-p/983909#M89756
May 18, 2008
May 18, 2008
Copy link to clipboard
Copied
This might work:
<cfset toBase10 = inputbasen("FFA0",16)>
<cfset newResult = ReplaceNoCase(result.column, chr(toBase10), ' ',"all")>
<cfset toBase10 = inputbasen("FFA0",16)>
<cfset newResult = ReplaceNoCase(result.column, chr(toBase10), ' ',"all")>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/replacing-non-ascii-characters-in-string/m-p/983910#M89757
May 18, 2008
May 18, 2008
Copy link to clipboard
Copied
This worked:
REReplace(string, '[^\x00-\x7F]', ' ', "ALL")
REReplace(string, '[^\x00-\x7F]', ' ', "ALL")
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

