Questions tagged [ascii]

A character-encoding scheme based on the ordering of the English alphabet. ASCII stands for American Standard Code for Information Interchange.

ASCII codes represent text in computers, communications equipment, and other devices that use text. Most modern character-encoding schemes are based on ASCII, though they support many more characters than did ASCII.

ASCII includes definitions for 128 characters: 33 are non-printing control characters (now mostly obsolete) that affect how text and space is processed; 94 are printable characters, and the space is considered an invisible graphic. The most commonly used character encoding on the World Wide Web was US-ASCII until December 2007, when it was surpassed by UTF-8.

The following table contains the 128 ASCII characters.

Char  Dec  Oct Hex | Char Dec  Oct Hex | Char Dec  Oct Hex | Char Dec  Oct  Hex
(nul)   0 0000 x00 | (sp)  32 0040 x20 | @     64 0100 x40 | `      96 0140 x60
(soh)   1 0001 x01 | !     33 0041 x21 | A     65 0101 x41 | a      97 0141 x61
(stx)   2 0002 x02 | "     34 0042 x22 | B     66 0102 x42 | b      98 0142 x62
(etx)   3 0003 x03 | #     35 0043 x23 | C     67 0103 x43 | c      99 0143 x63
(eot)   4 0004 x04 | $     36 0044 x24 | D     68 0104 x44 | d     100 0144 x64
(enq)   5 0005 x05 | %     37 0045 x25 | E     69 0105 x45 | e     101 0145 x65
(ack)   6 0006 x06 | &     38 0046 x26 | F     70 0106 x46 | f     102 0146 x66
(bel)   7 0007 x07 | '     39 0047 x27 | G     71 0107 x47 | g     103 0147 x67
(bs)    8 0010 x08 | (     40 0050 x28 | H     72 0110 x48 | h     104 0150 x68
(ht)    9 0011 x09 | )     41 0051 x29 | I     73 0111 x49 | i     105 0151 x69
(nl)   10 0012 x0a | *     42 0052 x2a | J     74 0112 x4a | j     106 0152 x6a
(vt)   11 0013 x0b | +     43 0053 x2b | K     75 0113 x4b | k     107 0153 x6b
(np)   12 0014 x0c | ,     44 0054 x2c | L     76 0114 x4c | l     108 0154 x6c
(cr)   13 0015 x0d | -     45 0055 x2d | M     77 0115 x4d | m     109 0155 x6d
(so)   14 0016 x0e | .     46 0056 x2e | N     78 0116 x4e | n     110 0156 x6e
(si)   15 0017 x0f | /     47 0057 x2f | O     79 0117 x4f | o     111 0157 x6f
(dle)  16 0020 x10 | 0     48 0060 x30 | P     80 0120 x50 | p     112 0160 x70
(dc1)  17 0021 x11 | 1     49 0061 x31 | Q     81 0121 x51 | q     113 0161 x71
(dc2)  18 0022 x12 | 2     50 0062 x32 | R     82 0122 x52 | r     114 0162 x72
(dc3)  19 0023 x13 | 3     51 0063 x33 | S     83 0123 x53 | s     115 0163 x73
(dc4)  20 0024 x14 | 4     52 0064 x34 | T     84 0124 x54 | t     116 0164 x74
(nak)  21 0025 x15 | 5     53 0065 x35 | U     85 0125 x55 | u     117 0165 x75
(syn)  22 0026 x16 | 6     54 0066 x36 | V     86 0126 x56 | v     118 0166 x76
(etb)  23 0027 x17 | 7     55 0067 x37 | W     87 0127 x57 | w     119 0167 x77
(can)  24 0030 x18 | 8     56 0070 x38 | X     88 0130 x58 | x     120 0170 x78
(em)   25 0031 x19 | 9     57 0071 x39 | Y     89 0131 x59 | y     121 0171 x79
(sub)  26 0032 x1a | :     58 0072 x3a | Z     90 0132 x5a | z     122 0172 x7a
(esc)  27 0033 x1b | ;     59 0073 x3b | [     91 0133 x5b | {     123 0173 x7b
(fs)   28 0034 x1c | <     60 0074 x3c | \     92 0134 x5c | |     124 0174 x7c
(gs)   29 0035 x1d | =     61 0075 x3d | ]     93 0135 x5d | }     125 0175 x7d
(rs)   30 0036 x1e | >     62 0076 x3e | ^     94 0136 x5e | ~     126 0176 x7e
(us)   31 0037 x1f | ?     63 0077 x3f | _     95 0137 x5f | (del) 127 0177 x7f
6938 questions
2
votes
0 answers

Steganography of JFIF file

In cyber security competition, there was one single question about steganography, which was only solved by two teams, but the solution was not published afterwards. Considering that i have very little experience in steganography and cryptography, I…
ShellRox
  • 2,532
  • 6
  • 42
  • 90
2
votes
3 answers

What is an easy way to implement fprintf in python?

In python, the following will let us write to stdout: import sys sys.stdout.write("blah %d" % 5) However, I want to be flexible about which stream we print to. I want to pass the stream as an argument into a function, as you would when calling…
Toothpick Anemone
  • 4,290
  • 2
  • 20
  • 42
2
votes
2 answers

tuples with unicode fix

I have some tuples from an sql query that are a list of album names. However, they output in unicode giving it u' before each name, which I would like to remove. It prints out like this: ((u'test',), (u'album test',), (u'test!',), (u'',),…
helloworld
  • 399
  • 3
  • 9
  • 21
2
votes
4 answers

Put characters received from an array in alphabetical order without using sorting functions?

So, basically, I created an algorithm in java that takes characters from a string and counts its frequencies. Now, I need it to be printed in alphabetical order. For example : A freq: 3 d freq: 1 l freq: 5 Any suggestions? Here's what I have thus…
user8790391
2
votes
1 answer

Trying to open a text file and create a list of lines separating the between sentences.

Using Python 3.6 and Spyder. This one is driving me crazy and should be easy, but I am stumped. I am trying to open a text file and create a list of the lines. I am trying to separate the lines based on periods. I want to be able to do something…
Eric
  • 103
  • 11
2
votes
1 answer

Python: different byte values for the same character?

The program I'm writing captures individual keypresses with the function mscvrt.getch(), which works very similarly to the C function of the same name, but instead of returning a char variable, it returns a byte, which I have to decode…
Tiodani
  • 115
  • 7
2
votes
1 answer

Exclude non printable characters except new line

I've an issue like this: string filter: detect non-ASCII signs in C# but I should exclude all no-printable characters in a string except new line chars (\n). Starting from Regex option: foo = System.Text.RegularExpressions.Regex.Replace(foo,…
user2595496
  • 111
  • 1
  • 7
2
votes
2 answers

Django issue : UnicodeEncodeError

I'm getting this common error in my code : Exception Type: UnicodeEncodeError Exception Value:'ascii' codec can't encode character u'\xe9' in position 6: ordinal not in range(128) Why ? Because I'm handling firstnames with french accents. This is…
Essex
  • 6,042
  • 11
  • 67
  • 139
2
votes
1 answer

how to replace a character by its ascii in SQL SELECT statement in Oracle

The database we are using which we only have reading access has a character that is shown as a square, it has the ascii code of 26 or x1A in hex and i want to replace it in the SELECT statement to another character using its ascii only. We are using…
Bilal Abdulaal
  • 125
  • 1
  • 3
  • 11
2
votes
3 answers

Obfuscating Strings with ASCII and base 128

Suppose a string is a number system where each thing, it can be a char, DEL or any ASCII thing, has a corresponding number according to this ASCII table. How can you convert arbitrary string of the property to number in Python? An example #car =…
hhh
  • 50,788
  • 62
  • 179
  • 282
2
votes
2 answers

How to trim trailing 0 ASCII characters from a string in MS SQL Server

I have a string of type VARCHAR(128) in MS SQL Server, which has this value: 'abc '. However, these trailing "spaces" are not regular spaces (ASCII 32), they are of ASCII 0. I want to trim these trailing "spaces", but I could not get it to…
sfandler
  • 610
  • 5
  • 23
2
votes
2 answers

How to convert ascii char to byte in c#

Hello I have a problem with conversion from ASCII to Byte. I have the code: byte M = Convert.ToByte('M'); but this converts from UTF-16 to byte with I don't want. In my problem I would like to send bytes with ASCII codes.
usmauriga
  • 73
  • 1
  • 1
  • 5
2
votes
4 answers

Unpacking COMP-3 digit using Java

I have a file with some COMP-3 encoded fields. Can someone please tell me how do I test this code in below thread ? How to unpack COMP-3 digits using Java? Code I tried is BufferedReader br = new BufferedReader(new FileReader(FILENAME))) { …
Rahul Patel
  • 307
  • 1
  • 9
  • 27
2
votes
1 answer

Reversed endianness in text editor

As part of an exercise to play with binary and ascii formats, I wrote the integer 49 to a file using a C program. In binary, its 4 byte representation is 00000000 00000000 00000000 00110001 In ascii, the first 3 bytes are null bytes (displayed as…
Korizon
  • 3,677
  • 7
  • 37
  • 52
2
votes
1 answer

Cryptic Ruby syntax for averaging ASCII values

I saw an intriguing answer to a simple question. The question was: "Get the average of the ASCII values of each character in a string read from gets" One of the correct answer was: p gets.sum/~/$/ I searched Google but couldn't find any explanation…
frank
  • 295
  • 3
  • 8