I need to convert ascii chars to hex chars.
I searched the internet, found hex to ascii, but nowhere is there a
ascii to hex method created by anyone.
Can anyone help me with that?
Chears 5 51513 ku********@gmai l.com wrote:
I need to convert ascii chars to hex chars.
I searched the internet, found hex to ascii, but nowhere is there a
ascii to hex method created by anyone.
Can anyone help me with that?
Chears
Hi,
You question is a bit confusing. :-)
hex is nothing more than a 16-base notation.
ascii is definition to declare the first 128 values of a byte to characters
(or more depending on which one you pick).
So that are two different animals.
In PHP:
int -ascii char : chr() http://nl2.php.net/manual/en/function.chr.php
ascii -int : ord() http://nl2.php.net/manual/en/function.ord.php
Note that the int is 10-base, so you'll have to transform it into hex by
using dexhex() and hexdec() depending on the direction. :-)
Also, this may be of use: http://www.lookuptables.com/
Hope that helps you going.
Regards,
Erwin Moller ku********@gmai l.com wrote:
I need to convert ascii chars to hex chars.
I searched the internet, found hex to ascii, but nowhere is there a
ascii to hex method created by anyone.
Can anyone help me with that?
Chears
I created such a method some time ago - maybe it can help you...
function ascii2hex($asci i) {
$hex = '';
for ($i = 0; $i < strlen($ascii); $i++) {
$byte = strtoupper(dech ex(ord($ascii{$ i})));
$byte = str_repeat('0', 2 - strlen($byte)). $byte;
$hex.=$byte." ";
}
return $hex;
}
function hex2ascii($hex) {
$ascii='';
$hex=str_replac e(" ", "", $hex);
for($i=0; $i<strlen($hex) ; $i=$i+2) {
$ascii.=chr(hex dec(substr($hex , $i, 2)));
}
return($ascii);
}
adlerweb
<ku********@gma il.comwrote in message
news:11******** *************@m 79g2000cwm.goog legroups.com...
>I need to convert ascii chars to hex chars.
I searched the internet, found hex to ascii, but nowhere is there a
ascii to hex method created by anyone.
$hex = "64";
$ascii = "a";
echo chr(hexdec($hex ));
echo dechex(ord($asc ii));
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis sp**@outolempi. net || Gedoon-S @ IRCnet || rot13(xv***@bhg byrzcv.arg)
Thanks all,
I found it thanks to these posts:
$len = strlen('The lenght of the text is 28');
$a = round(($len / 16));
$b = round(($len - 16) * $a);
echo chr(dechex($b)) ;
Kimmo Laine wrote:
<ku********@gma il.comwrote in message
news:11******** *************@m 79g2000cwm.goog legroups.com...
I need to convert ascii chars to hex chars.
I searched the internet, found hex to ascii, but nowhere is there a
ascii to hex method created by anyone.
$hex = "64";
$ascii = "a";
echo chr(hexdec($hex ));
echo dechex(ord($asc ii));
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis sp**@outolempi. net || Gedoon-S @ IRCnet || rot13(xv***@bhg byrzcv.arg)
<ku********@gma il.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
Thanks all,
I found it thanks to these posts:
$len = strlen('The lenght of the text is 28');
$a = round(($len / 16));
$b = round(($len - 16) * $a);
echo chr(dechex($b)) ;
That makes no sense to me. But I'm not gonna say anything, if you feel you
got it right and you think it somehow works (does what you want to do) then
it's okay. But it does not, however, convert a hex to an ascii. instead it
converts "something" (I have absolutely no idea what the string length and a
few mathematical operations are supposed to produce) from decimal number to
hex and that to ascii which is totally not what you asked. But perhpas this
is what you want, I dunno...
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis sp**@outolempi. net || Gedoon-S @ IRCnet || rot13(xv***@bhg byrzcv.arg) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: chandy |
last post by:
Hi,
I have an Html document that declares that it uses the utf-8 character
set. As this document is editable via a web interface I need to make
sure than high-ascii characters that may be accidentally entered are
properly represented when the document is served. My programming
language allows me to get the ascii value for any individual character
so what I am doing when a change is saved is to look at each character
in the content and...
|
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 characters"(No. 128 to 255) . e.g., in
one version No. 224 is the symbol alpha, in another, it's a "a" with a ` on
it... How come?
You can see it here:
http://www.kturby.com/cables/ascii2.htm
|
by: Martín Marconcini |
last post by:
Hello there,
I'm writting (or trying to) a Console Application in C#. I has to be
console.
I remember back in the old days of Cobol (Unisys), Clipper and even Basic,
I used to use a program (its name i cannot recall now...) where I designed
the "screen" using this "program" and then saved it into an ASCII file.
(thus, using 'extended' ASCII's like Lines, Corners, etc. and making
screens look nicer and more professional). Then reading a...
|
by: Ger |
last post by:
I have not been able to find a simple, straight forward Unicode to ASCII
string conversion function in VB.Net.
Is that because such a function does not exists or do I overlook it?
I found Encoding.Convert, but that needs byte arrays.
Thanks,
/Ger
|
by: Claude Yih |
last post by:
Hi, everyone. I got a question. How can I identify whether a file is a
binary file or an ascii text file? For instance, I wrote a piece of
code and saved as "Test.c". I knew it was an ascii text file. Then
after compilation, I got a "Test" file and it was a binary executable
file. The problem is, I know the type of those two files in my mind
because I executed the process of compilation, but how can I make the
computer know the type of a...
| |
by: ChaosKCW |
last post by:
Hi
I am reading from an oracle database using cx_Oracle. I am writing to a
SQLite database using apsw.
The oracle database is returning utf-8 characters for euopean item
names, ie special charcaters from an ASCII perspective.
I get the following error:
> SQLiteCur.execute(sql, row)
|
by: Jeffrey Spoon |
last post by:
Hello, I'm a bit stuck trying to convert a text file which contains
extended ASCII text and changing the ASCII values so they become
readable. I do this by subtracting 127 from the ASCII value. However, at
the moment I am just getting more gibberish so I'm probably doing
something wrong. I tried using ASCII Encoding before to get the ASCII
values. Although this worked for 0-127 ASCII values, extended ASCII gave
strange values (such as 1992...
|
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= |
last post by:
PEP 1 specifies that PEP authors need to collect feedback from the
community. As the author of PEP 3131, I'd like to encourage comments
to the PEP included below, either here (comp.lang.python), or to
python-3000@python.org
In summary, this PEP proposes to allow non-ASCII letters as
identifiers in Python. If the PEP is accepted, the following
identifiers would also become valid as class, function, or
variable names: Löffelstiel,...
|
by: meendar |
last post by:
Hi,
I am having a character pointer which contains ascii values. i just
want to convert all these ascii values to respective characters and
again store it in another character pointer.
Anybody please help in c language.
Thanks in Advance.
|
by: =?Utf-8?B?RGFu?= |
last post by:
I have the following code section that I thought would strip out all the
non-ascii characters from a string after decoding it. Unfortunately the
non-ascii characters are still in the string.
What am I doing wrong?
Dim plainText As String
plainText = "tâ•e"
Dim plainTextBytes() As Byte
Dim enc As Encoding = Encoding.ASCII
plainTextBytes = enc.GetBytes(plainText)
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |