Questions tagged [ascii]

An acronym of American Standard Code for Information Interchange, a well-known character encoding set.

Filter by
Sorted by
Tagged with
0
votes
0answers
20 views

Remove non printable characters from file in unix

We have a file with field delimiter as ~^ We are already removing control m characters from the file using sed -i 's/\r//g' filepath. Noticed the file has ^A and ^ in between data which is causing ...
0
votes
5answers
337 views

How to draw a continuous line in terminal?

I've been searching for this for a while and didn't get a satisfactory answer for it. I've taken this screenshot from the output of Gnu/Linux's tree command. I want to know how to draw or print ...
6
votes
3answers
327 views

BASH print question (printf \\$(printf '%03o' $1))

I used the following to convert from int to char and char to int in bash. But I do not understand how printf \\$(printf '%03o' $1) or printf '%d' "'$1" work. Please explain how printf \\$(printf '%...
0
votes
1answer
46 views

What should ASCII character 26 do?

I have code where I display ANSI art, I've found that last 128 bytes hold SAUCE meta data. The problem I have is just before the SAUCE data there is one character that looks out of place, that is ...
1
vote
0answers
25 views

Padding for a file containing Russian Cyrillic characters in a file not working

I am trying to create a file with fixed column lengths in Unix. The file contains Russian Cyrillic characters and those characters are interpreted different from the normal 1-byte characters. I am ...
0
votes
3answers
1k views

Do files actually contain an End Of File (EOF) character? [duplicate]

The Geostationary Operational Environmental Satellite (GOES)-R Product User Guide (PUG) from the National Oceanic and Atmospheric Administration (NOAA) contains the following rather wordy description ...
2
votes
1answer
58 views

Is there a character that sorts before the newline character, for managing sort order in 'ls'?

I'm developing some file naming guidelines, and I'm trying to find a way to allow a draft document to list before a final revision. Example: Currently my naming convention looks like this: ...
0
votes
1answer
70 views

Bash script to compare ASCII values [closed]

what is the wrong? #!/usr/local/bin/bash REF_FILE_NUM="000000010000001900000052" for id in `ls -1 dir` ; do FILE_NUM=${id:0:24} echo "FILE_NUM: $FILE_NUM ; REF_FILE_NUM: $REF_FILE_NUM" if [[ "$...
2
votes
0answers
473 views

Using iconv to convert utf-8 characters to the closest ASCII character

I can use the iconv command to "translit" a utf-8 string to an ASCII-only string with characters being replaced with their closest ASCII character. However, my problem is that I need the resulting ...
2
votes
1answer
166 views

Why does awk's printf interpret character values greater than 127 as multi-byte characters?

The ASCII character range is from 0 to 127, and within that range, awk's printf with the %c format specifier outputs one byte of data: $ awk 'BEGIN{printf "%c", 97}' a $ awk 'BEGIN{printf "%c", 127}'...
1
vote
1answer
175 views

How do I save image produced by asciiview?

When I run command asciiview image.jpg I'm able to view image in the terminal and quit browser using q key. I've tried different ways to redirect the output of the asciiview image.jpg to the console ...
0
votes
1answer
134 views

printf and echo -e are giving different results

I am using \0n escape sequence with echo -e and printf where n is the octal value of the ASCII character to be printed. When i used the statement echo -e "\0101" the shell is printing character A but ...
-1
votes
1answer
40 views

How do we get the readable string from big endian hex string

How do we get the readable string from hex string 0049006e00740072006f of BE which means as normal word, ie. we dont have to swap the byte pair per word tried with xxd in vain, cause I dont know ...
0
votes
1answer
789 views

Distinguish ascii from UTF-8 characters in the same file

On Ubuntu 18.04, I created a dummy text file with just one UTF-8 character, è. The other characters are all ascii: $ cat dummytext Hello Helloè This is the resulting hexdump: $ hexdump -C dummyfile ...
2
votes
1answer
373 views

Disabling utf-8 in all terminals?

This question pertains to my Ubuntu 18 system, as follows ... % uname -a Linux myhost.name.net 4.15.0-45-generic #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux I don't ...
0
votes
0answers
100 views

Set default file encoding to ASCII?

Years ago, most text editing applications had the option to set the default file encoding to US-ASCII. Now I can't find any recent editor on Linux that allows you to choose ASCII. If the purpose is to ...
5
votes
1answer
72 views

%c formatted string shows different behaviour in the shell and in C

If i write a very simple line of code in C: printf("Ascii char for %d is %c\n",65,65); It simply prints A, as ascii value of 65 corresponds to character A. But if I use the same code in shell and ...
0
votes
0answers
85 views

Creating Plain Text MAN Pages: Removing overstrike characters [duplicate]

I want to create plain text files of certain man pages such as the "ls" command. Simply performing a man ls > ls.txt, and then running file ls.txt will inform me that this is full of 'ASCII text, ...
1
vote
1answer
263 views

Hex code for '(' in bash regex

I have a strange behaviour in shell. When I try to match '_' in regex with its hex code it works, but not with '('. $ regex1=$'\x5f' $ pattern1='_' $ if [[ $pattern1 =~ $regex1 ]]; then echo yes; ...
0
votes
1answer
380 views

Embed ascii diagram in groff?

I have groff file to generate a pdf in the format: .TL Article title .AU Author name .AI Publication title .SH .LP First paragraph .PP More paragraphs I'm then running groff -ms a.ms -T pdf > a....
13
votes
3answers
15k views

Removing all non-ascii characters from a workflow (file)

How would I remove all non-ascii characters from one file? Would there be a specific command to perform this? grep --colour='auto' -P -n'[^\x00-\x7]' /usr/local/... I believe this finds the ...
0
votes
1answer
99 views

Interpolate Columnar Data

I am trying to find a way to interpolate between two lines of data in a CSV file, likely using awk. Right now, each line represents a data point at Hour 0 and Hour 6. I am looking to fill in missing ...
0
votes
0answers
146 views

file command gives incorrect encoding type

I have a csv file in hand. When I ran 'file -i filename', it shows that it's encoded as us-ascii. But when I ran cat filename | csvcut -t -e us-ascii, I got an error: "Your file is not "us-ascii" ...
2
votes
2answers
183 views

How to generate a ascii char in a string with Bash / ZSH correctly?

I'm trying to generate a string of 10 followed by a NULL (\0) followed by a 10. However echo "10\010" does not seem to work (I'm guessing it generates two chars - a 10 followed by \010. I'm not sure ...
0
votes
2answers
596 views

Replacing non printable characters with hex numerical values

I have a badly corrupted Sqlite file The usual trick of dumping everything into a sql file and loading it into a fresh file doesn't work, but with a hex editor I can see that the data I need to ...
5
votes
3answers
1k views

Are ASCII escape sequences and control characters pairings part of a standard?

There are common pairings of escape sequences to ASCII control characters, such as Ctrl-C and Ctrl-Z to ETX and SUB, respectively. On the Wikipedia Control Codes page, there are most pairings, but no ...
0
votes
1answer
3k views

curl with Umlaut causes “JSON parse error: Invalid UTF-8 middle byte 0x22” [duplicate]

I'm running below curl command from the command line (Git Bash on Windows) or as part of a Bash Script. curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d "{\"...
-2
votes
3answers
481 views

Bash Cat file to terminal centre

I have a text file with aome ascii art in it. I am trying to get it to print to the terminal on terminal start. I know to do this i add cat myfi in my .bashrc. i am stuck trying to get the output of ...
0
votes
1answer
59 views

Why Gedit's hash symbol is expanded and interpreted wrongly in internet browsers?

I copy-paste Gedit-hash (#) in a part of filepath into internet browser to read PDF file unsuccessfully: no file found with Gedit-hash symbol. Inputing there directly the hash symbol from the ...
2
votes
2answers
1k views

Want “tree” output utf8

▶ tree 下载 -L 1 \344\270\213\350\275\275 ├── BT ├── ISO ├── Let\ s\ Play\ -\ Sniper\ Elite\ v2\ Nazi\ Zombie\ Army.flv ├── sniper\ elite\ v2\ 02.flv └── \350\275\257\344\273\266\345\214\205 those 7-...
1
vote
3answers
6k views

Inputting extended ascii values

Hey so I'm losing my mind over this, I have some program written in c that gets some string as an input directly from terminal then prints the ascii value of each byte entered within the string, I'm ...
-1
votes
1answer
530 views

what is ascii 7-bit character set and ascii 8-bit character set?

Im new to this, so ascii 7 bit can represent 128 values, then ascii 8 can represent 256 values? this right? ascii 7-bit character set: 01000001 represents ‘A’ how would a look like in ascii 8 bit? or ...
1
vote
1answer
253 views

How to find non-British non-ASCII non-LaTeX characters for pdftex?

I am debugging my tex file by eliminating all technical flaws in the systems. I cannot find anything wrong in my document with Tex community here and myself so I think there can be something non-ASCII ...
5
votes
3answers
17k views

Difference between EOT and EOF

I understand that EOT is ASCII code 4, whereas EOF is encoded as -1 (at least in C). Before I found out that EOF is mapped to -1, I thought it was just a synonym for EOT. Why is EOF mapped to -1 ...
1
vote
1answer
387 views

Entering ascii chars as program input

If I write a very simple C terminal program that takes an input, how can I enter an ascii character as the input, like for instance the backspace character?
2
votes
3answers
2k views

How to determine the character encoding that a terminal uses in a C/C++ program?

I've noticed that SyncTERM uses a different character encoding than the default MacOS terminal emulator, and they're incompatible with one another. For example, say you want to print a block ...
2
votes
1answer
444 views

Why won't chfn allow non-ascii chars or equal signs? [closed]

I'm wondering what the historical purpose is of designing chfn command to warn people over the use of non-ASCII symbols, (and why only enforce it for phone numbers?) Is this something that still ...
0
votes
1answer
632 views

Does gzip removes ASCII values

I have a txt file in which i have multiple ASCII values.Like the below one which is the example : including complimentary high-speed internet access, in-room hospitality center with microwave, ...
1
vote
4answers
1k views

Keystrokes for ASCII control codes

Okay, so I've recently realized the correspondence between Control keystrokes and ASCII control codes, e.g. ^D sends the EOT character because EOT is ASCII code 4 and D is the fourth letter in the ...
12
votes
7answers
29k views

How do I print an ASCII character by different code points in Bash?

In the ASCII table the 'J' character exists which has code points in different numeral systems: Oct Dec Hex Char 112 74 4A J It's possible to print this char by an octal code point by ...
1
vote
1answer
254 views

locate outputs question marks when locatedb contains certain characters (tabs) unless output is piped

I construct my own locatedb using frcode so it would contain filesizes after paths (it helps me look for large files quickly). I store the path separated from the size by a tab character. I've noticed ...
1
vote
1answer
507 views

store file with invalid characters

Some files we get from a customer could not be processed properly because they were declared as US-ASCII but contained invalid characters. In order to validate a software fix, I am trying to copy ...
19
votes
2answers
5k views

Why doesn't the Enter key send EOL?

Unix / Linux EOL is LF, linefeed, ASCII 10, escape sequence \n. Here's a Python snippet to get exactly one keypress: import sys, tty, termios fd = sys.stdin.fileno() old_settings = termios.tcgetattr(...
1
vote
2answers
124 views

ERROR: integer expression expected - comparing tables

I have a small bash program, that allows me to compare tables (having similar naming style) and that copies to another directory the file having the highest value at the first row of the fourth column ...
0
votes
1answer
138 views

Display non-printable parameters in running processes

ps aux displays commands running on the server, but it does not display non-printable parameters in any sort of way that is useful. mycmd.sh: #!/bin/bash while true do sleep 5 done ...
2
votes
2answers
866 views

How to convert an special hex character from an html page in bash? [duplicate]

I have a script which process some information coming from a web page. I guess that because of the encoding of the page, some special characters are encoded in hexadecimal. For example, I have the the ...
1
vote
1answer
736 views

What happens when I echo with `-e` argument?

As you can see, I have created index.php as follows: $ echo -e "<?php passthru(\$_POST[1])?>\r<?php echo 'A PHP Test ';" > index.php and then: $ cat index.php <?php echo 'A PHP Test '...
2
votes
1answer
9k views

blessdiff for the “full featured hexadecimal editor”?

I am trying to find some hex diftool which allows me to compare to documents in the view but also the internal differences like in bless so two bless windows side-by-side but with diff capability ...
3
votes
4answers
9k views

How to produce a CR/LF in linux text docs? [closed]

How do you produce a CR/LF anywhere in a text document created in linux OS so that it can be copied and pasted into a windows text editor or onto the web and retain the CR/LF to be read and acted upon ...
3
votes
3answers
101 views

printing a series of characters

My ultimate goal here is to generate a block of text that can be used to test out various fonts at a terminal. I want to generate the file as basically an ascii chart. A series of characters from 1 ...