473,568 Members | 2,923 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 1122

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_dec ode 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_ca llback('/#(\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*******@NOSP AMdemogracia.co ma é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_ca llback('/#(\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
2913
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" CONTENT="text/html; charset=UTF-8"> When people enter new data I use
0
2253
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/ default-character-set=cp1251 Then restarted server and created a simple database
4
11488
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 should have sufficed (of course it is the responsibility of the person performing the Load to ensure that the character he has chosen as column...
11
28240
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 question, but where is the FAQ section of the
5
6643
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 *s) { char *x;
18
4603
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 has some different characters in it that I am trying to remove. The small a with two dots over it and the small y with two dots over it. Here is my...
23
3166
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) { char a='Abbc'; printf("%c",a);
17
10630
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 talking with another team -- codepage -- at the same time. I am more confused when I saw sometimes we need codepage parameter for wide character...
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. But, the password filter needs to be built, so I'm doing my best. First of all, I am creating an xml string that contains both username and...
3
2469
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 dates/times, and is used by a number of other programs as well. I need to convert times that use this convention to python time representations, and because...
0
7693
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7665
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.