Questions tagged [ascii]

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

Filter by
Sorted by
Tagged with
12
votes
1answer
943 views

Why do ^M and \r behave inconsistently?

Perhaps there are already answers out there that indirectly answer my question, but I've read many of them and haven't yet found a satisfactory answer to this discrepancy. The original meaning of ...
3
votes
3answers
99 views

How to convert escape sequences to text while preserving display format?

I have a text file that contains (ANSI ?) escape sequences: When I cat the file I get formatted output: How do I save / pipe the output of the text file to a new file so that the control codes are ...
0
votes
0answers
32 views

Output of command “file <filename>” changes after opening the file with nano?

Background: I'm running a script on a raspberry pi, and the script writes logs to a file. The script take some time to finish so sometimes the pi experiences power outage and shuts down. Whenever this ...
0
votes
2answers
33 views

Where can I find the mapping between an ASCII encoding and its visualization?

I like to override the ASCII output in zsh with custom characters. 0x30 wouldn't be then '0' but for example 'Б'. I don't want just to substitute characters, but to change pixels through custom ...
0
votes
0answers
40 views

How to capture one image (screenshot) from asciinema?

How can I extract one asciinema image from a video, i.e. make a "screenshot"? As an output file I want a file with all ansi codes etc. My aim then is to convert it to HTML to then convert ...
3
votes
1answer
78 views

Renaming files with non-ASCII files to append their own datetime in ASCII

Multilingual environment and our file storage on linux of course allows all those international (Asian) characters in filenames. But this is causing problems syncing to other systems because the ...
3
votes
2answers
86 views

Search for filenames containing extended ascii characters

I want to find all filenames in a directory tree that contain extended ASCII characters (0x80-0xFF). I thought that I could do this like this: find . -regex '.*[\x80-\xFF]+.*' but instead it matches ...
5
votes
2answers
341 views

How to handle “YouTube filenames” containing arabic, chinese, hindi characters in bash script?

I downloaded many YouTube videos and want to process them using bash scripts. However the filenames used contain all kinds of special and non-ASCII characters. How do I handle this in a bash script? ...
0
votes
2answers
67 views

uniq -i is does not ignore case-sensitive in non-Ascii characters

I have a txt: a.txt A a B b Ş ş I try this command and I get false output: $ uniq -ic a.txt 2 A 2 B 1 Ş 1 ş How can I solve the non-ascii character problem ...
0
votes
5answers
2k 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 ...
7
votes
3answers
807 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
245 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 ...
1
vote
3answers
5k 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
98 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
173 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
962 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 ...
2
votes
1answer
326 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
321 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
206 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
63 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
2k 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
747 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 ...
5
votes
1answer
104 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 ...
1
vote
1answer
395 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; ...
1
vote
2answers
667 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....
15
votes
3answers
24k 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
129 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
188 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
327 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
1k 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
2k 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
5k 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
4answers
624 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 ...
-1
votes
1answer
74 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 ...
3
votes
2answers
2k 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
8k 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
556 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
287 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 ...
12
votes
3answers
26k 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
405 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 ...
3
votes
1answer
580 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
778 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 ...
13
votes
7answers
43k 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
268 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
574 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
138 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 ...