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
37
votes
3 answers

Clearing the screen by printing a character?

I'm using chez-scheme and I can't find a way to clear the screen completely. (If someone knows a better way than printing I'd be interested in that too but it's not my question here) From what I can find clearing the screen by ^L (control-L) or…
Lara
  • 2,594
  • 4
  • 24
  • 36
37
votes
2 answers

How to convert ASCII value to a character in Objective-C?

I was wondering if anyone has the following php function equivalents in Objective-C for iPhone development: ord() # returns the ASCII value of the first character of a string. chr() # returns a character from the specified ASCII value. Many…
topace
  • 1,791
  • 3
  • 17
  • 23
35
votes
12 answers

What's the equivalent of VB's Asc() and Chr() functions in C#?

VB has a couple of native functions for converting a char to an ASCII value and vice versa - Asc() and Chr(). Now I need to get the equivalent functionality in C#. What's the best way?
Shaul Behr
  • 36,951
  • 69
  • 249
  • 387
35
votes
4 answers

ASCII value of character in Ruby

How do I obtain the ASCII value of a character in Ruby 1.9? I searched the Internet far and wide, but without success. I tried ?x and "x"[0], but all they return is "x".
LakatosI
  • 395
  • 1
  • 3
  • 9
35
votes
18 answers

Finding and removing Non-ASCII characters from an Oracle Varchar2

We are currently migrating one of our oracle databases to UTF8 and we have found a few records that are near the 4000 byte varchar limit. When we try and migrate these record they fail as they contain characters that become multibyte UF8…
Paul Gilfedder
  • 553
  • 1
  • 5
  • 16
35
votes
7 answers

Ruby: character to ascii from a string

this wiki page gave a general idea of how to convert a single char to ascii http://en.wikibooks.org/wiki/Ruby_Programming/ASCII But say if I have a string and I wanted to get each character's ascii from it, what do i need to do? "string".each_byte…
user2668
  • 353
  • 1
  • 3
  • 4
35
votes
2 answers

Are Unicode and Ascii characters the same?

What exactly are unicode character codes? And how are they different from ascii characters?
Ghost
  • 1,777
  • 6
  • 31
  • 44
35
votes
43 answers

How do you generate passwords?

How do you generate passwords? Random Characters? Passphrases? High Ascii? Something like this? cat /dev/urandom | strings
px.
  • 139
  • 2
  • 6
  • 12
34
votes
4 answers

Getting The ASCII Value of a character in a C# string

Consider the string: string str="A C# string"; What would be most efficient way to printout the ASCII value of each character in str using C#.
Shamim Hafiz - MSFT
  • 21,454
  • 43
  • 116
  • 176
34
votes
8 answers

htop output to human readable file

I've tried piping htop to a text file (e.g. htop > text.txt) but it gives me text garbled by formatting strings (see below). Is there a way to get nicer, human readable output? ^[7^[[?47h^[[1;30r^[[m^[[4l^[[?1h^[=^[[m^[[?1000h^[[m^[[m^[[H^[[2J^[[1B…
DilithiumMatrix
  • 17,795
  • 22
  • 77
  • 119
33
votes
4 answers

How do I get the byte values of a string in PHP?

Say I have a string in php, that prints out to a text file like this: nÖ§9q1Fª£ How do I get the byte codes of this to my text file rather than the funky ascii characters?
lynn
  • 2,868
  • 5
  • 31
  • 34
33
votes
5 answers

How do I keep whitespace formatting using PHP/HTML?

I'm parsing text from a file and storing it in a string. The problem is that some of the text in the original files contains ASCII art and whatnot that I would like to preserve. When I print out the string on the HTML page, even if it does have…
Steven Oxley
  • 6,563
  • 6
  • 43
  • 55
33
votes
2 answers

How to get the ASCII value of a character in Haskell?

How to get the ASCII value of a character in Haskell? I've tried to use the ord function in GHCi, based on what I read here bug the the error message: Not in scope: `ord' For example: GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for…
Chris
  • 39,719
  • 45
  • 189
  • 235
33
votes
4 answers

Convert an int value to unicode

I am using pyserial and need to send some values less than 255. If I send the int itself the the ascii value of the int gets sent. So now I am converting the int into a unicode value and sending it through the serial…
user2578666
  • 1,123
  • 3
  • 12
  • 19
33
votes
7 answers

bash ascii to hex

was wondering if anyone could help me with converting ascii to hex in bash. Example code: #!/bin/bash STR = "hello" #Convert to hex HEXVAL = $STR #(in hex here?) I want hexval to have the value: 68656C6C6F (hello in hex)
user1739261
  • 339
  • 1
  • 3
  • 5