473,386 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Remove all unicode from a string

I am trying to use php to remove all unicode from a string. What I am
seeing it the white question mark with a black diamond. I have tried
html_entity_decode and preg_replace but had no luck. Any help would be
greatly appreciated. Thanks!

Jun 13 '07 #1
1 5886
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

je***@mynetserv.com wrote:
I am trying to use php to remove all unicode from a string. What I am
seeing it the white question mark with a black diamond. I have tried
html_entity_decode and preg_replace but had no luck. Any help would be
greatly appreciated. Thanks!
Try utf8_decode()
<http://us2.php.net/manual/en/function.utf8-decode.phpNote that this
function will replace your Unicode characters with question marks, and
will not convert valid ISO-8859-1 characters.

- --
Edward Z. Yang GnuPG: 0x869C48DA
HTML Purifier <htmlpurifier.org Anti-XSS HTML Filter
[[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGcxKOqTO+fYacSNoRAny9AJ4my5eKYF4wvVvWTiax7s kAuY7PUACfVnJb
94TPMeMTzZUB+zFY8b5ANMc=
=q0TX
-----END PGP SIGNATURE-----
Jun 15 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Bill Eldridge | last post by:
I'm trying to grab a document off the Web and toss it into a MySQL database, but I keep running into the various encoding problems with Unicode (that aren't a problem for me with GB2312, BIG 5,...
4
by: Achim Domma | last post by:
Hi, I read some text from a utf-8 encoded text file like this: text = codecs.open('example.txt','r','utf8').read() If I pass this text to a COM object, I can see that there is still the BOM...
7
by: Robert Oschler | last post by:
Is there a module/function to remove all the HTML entities from an HTML document (e.g. - &nbsp, &amp, &apos, etc.)? If not I'll just write one myself but I figured I'd save myself some time. ...
2
by: Neil Schemenauer | last post by:
python-dev@python.org.] The PEP has been rewritten based on a suggestion by Guido to change str() rather than adding a new built-in function. Based on my testing, I believe the idea is...
11
by: deko | last post by:
I need to loop through a string and remove all characters except numbers or letters. I am getting an ArgumentOutOfRangeException: "Index was out of range. Must be non-negative and less than the...
4
by: శ్రీనివాస | last post by:
Hai friends, Can any one tell me how can i remove a character from a unocode text. కల్‌&హార is a Telugu word in Unicode. Here i want to remove '&' but not replace with a zero width...
9
by: Frank Potter | last post by:
I only want to remove the comments which begin with "//". I did like this, but it doesn't work. r=re.compile(ur"//+$", re.UNICODE|re.VERBOSE) f=file.open("mycpp.cpp","r") f=unicode(f,"utf8")...
11
by: cody | last post by:
Is there a method to replace special characters like (A-Umlaut) with A, (O-Umlaut) with O, and so on? Sure, I could look for each character separately and replace it with its...
2
by: Konstantinos Pachopoulos | last post by:
Hi, i have the following string s and the following code, which doesn't successfully remove the "\", but sucessfully removes the "\\". .... if i!="\\": .... newS=newS+i .......
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.