Character entity usage
Hello,
Using coldfusion 2016. have some queries related to character entity values.
Tried html equivalent character entity for replacing trademark and apostrphe special characters. Function used is given below.
private any function specialCharUpdate(strData){
// Ampersand
arguments.strData = replacenocase(strData, '&', '&##38;', 'All');
// ™ trademark
// arguments.strData = replace(strData, '™', '&##8482;', 'All');
arguments.strData = replacenocase(strData, '™', ' &##153;', 'All');
// Apostrophe
arguments.strData = replacenocase(strData, '''', '&##39;', 'All');
arguments.strData = replacenocase(strData, '’', '&##39;', 'All');
// Circle
arguments.strData = replacenocase(strData, '®', '&##174;', 'All');
// Copyright
arguments.strData = replacenocase(strData, '©', '&##169;', 'All');
return arguments.strData;
}
1) The apostrphe from keyboard ' is getting replaced with '
But another kind of apostrphe ’ is not getting replaced with either ' or «This kind of 'â™' weird character is received
2) Trade mark symbol ™ is not getting updated with ™ or ™Instead like this 'â„¢'
Q:Can anybody suggest the right way to replace this?
3) Data insertion happens as ? on production environment where as in development environment it gets inserted additional symbol along with question mark symbol.
Both are using same codeset and sam cf version.
Q: What are the chance for different behaviour?
3) is it possible to give array as paramter for replacing
eg: array first parameter contain special data($search) and second array parameter contain code to replace($replace) like in php
str_replace($search, $replace, $description);
