473,503 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

character conversion

Hello,

I'd like to convert this kind of character :

#48;

into a human readable character :

0

I can't find the function that does this in the doc, so I used
str_replace...
does anyone know ?

thanks in advance,

--
larry
Aug 11 '06 #1
4 1114

larry wrote:
Hello,

I'd like to convert this kind of character :

#48;

into a human readable character :

0

I can't find the function that does this in the doc, so I used
str_replace...
does anyone know ?

thanks in advance,

--
larry
Where did you look exactly!?!

<?
echo chr(48);
?>

Aug 11 '06 #2
larry wrote:
I'd like to convert this kind of character :

#48;

into a human readable character :

0

I can't find the function that does this in the doc, so I used
str_replace...
does anyone know ?
You can convert 0 to 0 with
http://www.php.net/manual/en/functio...ity-decode.php function
or use preg_replace. Some examples are in user notes of
html_entity_decode function documentation.

--
Tomasz Rup

Aug 11 '06 #3
*** larry escribió/wrote (Fri, 11 Aug 2006 08:25:39 +0200):
I'd like to convert this kind of character :

#48;

into a human readable character :

0
Two suggestions:
<?

$foo='This tring has some chars like #48;, #120; or #64;';
echo preg_replace('/#(\d+);/e', 'chr($1)', $foo);
function char_from_code($foo){
return chr($foo[1]);
}
echo preg_replace_callback('/#(\d+);/', 'char_from_code', $foo);

?>
Yep, I know you probably didn't mean this ;-)
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Aug 11 '06 #4
"Alvaro G. Vicario" <we*******@NOSPAMdemogracia.coma écrit dans le message
de news: 1q*******************************@40tude.net...
*** larry escribió/wrote (Fri, 11 Aug 2006 08:25:39 +0200):
>I'd like to convert this kind of character :

#48;

into a human readable character :

0

Two suggestions:
<?

$foo='This tring has some chars like #48;, #120; or #64;';
echo preg_replace('/#(\d+);/e', 'chr($1)', $foo);
function char_from_code($foo){
return chr($foo[1]);
}
echo preg_replace_callback('/#(\d+);/', 'char_from_code', $foo);

?>
Yep, I know you probably didn't mean this ;-)
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
thank you all for your answers.

--
larry
Aug 12 '06 #5

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

Similar topics

7
2905
by: WindAndWaves | last post by:
Hi Folk Here I am writing my first php / mysql site, almost ready, and now this... charactersets.... The encoding that I use on my webpage is: <META HTTP-EQUIV="content-type"...
0
2246
by: Tumurbaatar S. | last post by:
Hi, I'm running MySQL 3.23.55 on WinXP and have some problem using non latin charset. I've added these 2 lines under group of my.ini: character-sets-dir = c:/mysql/share/charsets/...
4
11466
by: Raquel | last post by:
Could someone explain to me what the reason is for having a character delimiter (which is double quotes by default) for performing Loads/Imports on UDB? I would think that column delimiter along...
11
28223
by: Mars | last post by:
char c; int i; scanf("%d",&i); c=getchar(); I want to read a integer and a character in 2 lines. Why the getchar always get the \n character from the last line????? (Sorry for my newbie...
5
6632
by: Stefan Krah | last post by:
Hello, I am currently writing code where it is convenient to convert char to int . The conversion function relies on a character set with contiguous alphabets. int set_mesg(Key *key, char...
18
4582
by: james | last post by:
Hi, I am loading a CSV file ( Comma Seperated Value) into a Richtext box. I have a routine that splits the data up when it hits the "," and then copies the results into a listbox. The data also...
23
3148
by: Akhil | last post by:
Since a character constant is an int value represented as a character in single quotes,so it is treated as a 1 byte integer now look at the following snippet. #include<stdio.h> int main(void)...
17
10612
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, Wide character and multi-byte character are two popular encoding schemes on Windows. And wide character is using unicode encoding scheme. But each time I feel confused when...
6
4068
by: ssetz | last post by:
Hello, For work, I need to write a password filter. The problem is that my C+ + experience is only some practice in school, 10 years ago. I now develop in C# which is completely different to me....
3
2459
by: Evan Klitzke | last post by:
Although it is not present in ANSI C, the GNU version of stftime supports the conversion character %z, which is a time offset from GMT. The four digit time offset is required in RFC 2822...
0
7084
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
7278
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,...
0
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7458
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5013
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.