473,322 Members | 1,259 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,322 software developers and data experts.

Replace extended ascii characters

I've some text with some extended ascii characters like ¿ or ¡ and I
wanna replace these characters for blanks, but when I use the function
str_replace, it returns an invalid string, so I think that php cannot
detect these kind of characters and of course, it cannot replace them.

I've already tried to use mb_ereg_replace, but it doesn´t work. Has
anybody any idea how can I get a solution for this problem?

Thanks in advance!

Mar 22 '07 #1
2 18609
Have you tried using the str_replace with the chr function. Something
like: str_replace(chr(168), ' ', $str);

There is also a function that a user submitted on this PHP manual page
that replaces all non-readable characters with a '.', you could change
it to make it a blank and it might work exactly for your needs.

http://us3.php.net/chr

Mar 22 '07 #2
I've found a solution. str_replace works right, but the problem was
that I get the string from a database and it seems that it was an
strange character (ascii 194), that had to be next to ¡ or ¿ (ascii
161 and 191), I don't know why, but....

Now, to replace the ¡ and ¿, I must use
str_replace(array(chr(194).chr(161),chr(194).chr(1 91),"?","!"),"",
$literal);
Mar 22 '07 #3

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

Similar topics

4
by: wob | last post by:
Many thanks for those who responded to my question of "putting greek char into C string". In searching for an solution, I noticed that there are more than one version of "Extended ASCII...
1
by: Bülent Üstün | last post by:
Hi, im trying to upload somefiles using sockets to a FTP site. But i've some problems with extended ascii characters. When i try "MKD bülent" the created folder is "blent". The directory name is...
4
by: ASP Yaboh | last post by:
I am using StreamWriter's .Writeline() method to create a simple text file. I found that ASCII characters 255 & 254 are being inserted as the first two characters of the file which causes a...
3
by: JSM | last post by:
Hi, I am just trying to port an existing simple encryption routine to C#. this routine simply adds/substracts 10 ascii characters to each character in a text file (except quotes). The routine...
0
by: Nickneem | last post by:
I'm having trouble getting the output of a (MS SQL server) query in html: ± is displayed as &# 177 ; and -» as - &# 187 ; not to mention the acute accent (é) and other diacritic characters. ...
10
by: Samuel Karl Peterson | last post by:
Greetings Pythonistas. I have recently discovered a strange anomoly with string.replace. It seemingly, randomly does not deal with characters of ordinal value 127. I ran into this problem while...
0
by: MTamas | last post by:
Hello, we have a legacy application written in C. It uses embedded sql to connect to the database and to perform queries on it. Now we are writing several extensions in .net, and it would be...
0
by: Wilson799799 | last post by:
Hello, I am searching for a way to match quotation marks (extended ascii characters 147 and 148) with a .net regex. I tried this regex += .... |" + System.Convert.ToChar(147) + "|" +...
0
by: jumperbl | last post by:
I am converting hex to ASCII and one of the words has a dot in the middle, which is in the extended ascii characters. when i do this i get the ascii chars. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.