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
1 answer

Assign characters a value for computation

I want to take a string and then do computation based on the characters in that string. a =1 b =2 c =3 test = 'cab' test_sum= [?] How can I make it so that I make "test_sum" equal to 6?
ashleybee97
  • 1,205
  • 3
  • 11
  • 8
2
votes
3 answers

Ascii character codes shown as text in browser

I run a website that has HTML tutorials on it. I am familiar with the use of ascii character codes like < and > when I am writing HTML tags on my website, but I want to show my users how to write their character codes like this. One of the…
user5832974
2
votes
2 answers

In python, why does calling a string, "X", display it in ASCII, but calling "print X" display it in unicode?

I've got a list of strings, along the lines of list=[a,b,c,d,e]. When I call list[2], the string c is displayed as ASCII; when I call print list[2], however, it's displayed as unicode. Why does this discrepancy exist?
scrollex
  • 2,575
  • 7
  • 24
  • 38
2
votes
1 answer

Convert ASCII File to netCDF using Python (selective columns from ASCII file)

Firstly I am new to this forum so please excuse as to any mistake I am doing in posting here. I would be glad if you could point me my mistakes out and I will make sure I don't repeat them when I post any thing else. Task: Converting ASCII Data…
2
votes
3 answers

Python : Text to ASCII & ASCII to text converter program

i am a newbie to python 2.7 , trying to create a simple program, which takes an input string from the user, converts all the characters into their ascii values, adds 2 to all the ascii values and then converts the new values into text. So for…
user417947
  • 21
  • 1
  • 2
2
votes
0 answers

Python ASCII Control Characters 28, 29, 30 and 31

I am creating a simple database style program for a project in school and I am using a simple hash and salt algorithm for storing passwords. I would like to use the Unit Separator and Record Separator ASCII codes to separate attributes and records…
PySheep
  • 21
  • 3
2
votes
3 answers

How to remove all conflicting characters between latin1 and utf-8 using python?

I call open(file, "r") and read some lines in Python. This gives me: UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 4: ordinal not in range(128) If I add 'utf-8', I get: 'utf8' codec can't decode bytes in position 28-29:…
OHHH
  • 1,011
  • 3
  • 16
  • 34
2
votes
1 answer

How to correct the encoding while creating excel file from 'utf-8' data using python

I am trying to create an excel file using python from a list of dictionaries. Initially I was getting an error of improper encoding. So I decoded my data to 'utf-8' format. Now after the creation of excel, when I checked the values in each field,…
Mohit Sharma
  • 179
  • 1
  • 2
  • 11
2
votes
1 answer

Add header to np.matrix

I am trying to export a numpy matrix to ASCII format, but I want to add a header to it first. My code concept is this: Import ASCII file as np.ndarray, say matrix A Take the header of A (first 6 rows). The header contains both float values and…
Litwos
  • 1,278
  • 4
  • 19
  • 44
2
votes
2 answers

How can i put a string in one line

i'm doing some conversion, from Hex to Ascii, when i convert the string, i got the following example: F23C040100C1 100D200000000000 0000 I know that the string is coming like this, because of the base 16, but i want too put it in just one line,…
Erico Campos
  • 23
  • 1
  • 3
2
votes
1 answer

How can I import ASCII file in Java?

I have code: package package; import java.io.BufferedReader; import java.io.FileReader; import java.util.ArrayList; import java.util.List; public class Test { private List liczby = new ArrayList(); public void…
Joe Michu
  • 19
  • 4
2
votes
3 answers

How to read/write extended ASCII characters as a string into ANSI coded text file in java

This is my encryption program. Primarily used to encrypt Files(text) This part of the program converts List elements intobyte [] and writes it into a text file. Unfortunately i cannot provide the algorithm. void printit(List prnt,…
TUG
  • 41
  • 1
  • 7
2
votes
2 answers

Replacing ASCII value of a char in a string in C

Is it possible anyhow to increment ASCII value of a char in C? Let's say I have following code int main(){ char *a = "This is my test string"; /* *(a+12) += 21; This isnt going */ printf("%c = %c\n", *(a+12), *(a+12)+21); …
Jumpman
  • 429
  • 1
  • 3
  • 10
2
votes
1 answer

How to display an apostrophe in HTML for viewmodel string property

My asp.net view displays a client's name at the top of every page using a layout template. This works fine except when the name property is assigned a value that contains an apostrophe. The view displays the ascii code for the apostrophe instead of…
ihatemash
  • 1,474
  • 3
  • 21
  • 42
2
votes
1 answer

Vigenere Cipher In C not working

I am attempting to make the vigenere cipher. Information about it is here: https://www.youtube.com/watch?v=9zASwVoshiM My code doesnt seem to work for a few cases. My code is listed below please dont send me a link how to make the vigenere cipher…
Kalyan Nadimpalli
  • 319
  • 1
  • 2
  • 10