Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
2 answers
59 views

iconv cannot convert from ASCII.. why?

I have this file. If I open it in Total Commander with F3 and press S the proper content will be shown. I tried to do the same thing in bash with iconv: iconv -f ASCII -t UTF8 input.txt but I got this:...
user avatar
0 votes
1 answer
49 views

Unable to change file encoding to utf-8

I modified a UTF-8 encoded xml file using vi editor and saved it. I'm on Redhat Linux 7.9 I checked the file encoding after the changes and found it to be us-ascii file --mime-encoding tmpfiles/08/...
user avatar
  • 297
0 votes
0 answers
35 views

"fold" not working on file converted from EBCDIC to ASCII

I have a file with one huge line (2,618,528 characters). It is in EBCDIC format and I need to convert it. I also need to introduce line breaks after 3784 characters so that I end with 692 lines of ...
user avatar
  • 25
4 votes
1 answer
171 views

grep a range of characters (decimal encoding)

I have a list of accepted characters: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI These characters can be translated in the ASCII decimal range 33-73 The implementation I'd like would ...
user avatar
  • 243
2 votes
2 answers
47 views

combine multiple commands like tr, iconv and dd

New to shell scripting, I have few commands like this. Is it optimal to have such temporary files or should I try to combine all these commands ? if it is latter, can you help me to redirect output ...
user avatar
  • 25
0 votes
1 answer
1k views

what does the following tr command do?

I am looking at a .sh script and one of the lines is the following: tr -d '\15' < file1.txt > /testProject/files/file1.txt i understood the part file1.txt > /testProject/files/file1.txt ...
user avatar
13 votes
1 answer
996 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 ...
user avatar
  • 415
3 votes
3 answers
800 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 ...
user avatar
  • 195
0 votes
0 answers
60 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 ...
user avatar
0 votes
2 answers
36 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 ...
user avatar
  • 1
3 votes
1 answer
190 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 ...
user avatar
  • 33
3 votes
2 answers
189 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 ...
user avatar
5 votes
2 answers
358 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? ...
user avatar
0 votes
2 answers
155 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 ...
user avatar
  • 184
3 votes
5 answers
4k 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 ...
user avatar
7 votes
3 answers
1k 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 '%...
user avatar
  • 131
0 votes
1 answer
868 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 ...
user avatar
  • 8,740
1 vote
0 answers
34 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 ...
user avatar
  • 11
1 vote
3 answers
9k 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 ...
user avatar
  • 3,277
2 votes
1 answer
170 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: ...
user avatar
  • 204
0 votes
1 answer
277 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 [[ "$...
user avatar
  • 9
3 votes
0 answers
2k 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 ...
user avatar
  • 478
2 votes
2 answers
853 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}'...
user avatar
  • 132
2 votes
2 answers
531 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 ...
user avatar
0 votes
1 answer
285 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 ...
user avatar
  • 409
-1 votes
1 answer
101 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 ...
user avatar
2 votes
1 answer
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 ...
user avatar
  • 4,493
2 votes
1 answer
1k 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 ...
user avatar
  • 281
5 votes
1 answer
132 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 ...
user avatar
  • 409
2 votes
1 answer
559 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; ...
user avatar
  • 31
1 vote
2 answers
859 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....
user avatar
15 votes
3 answers
27k 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 ...
user avatar
  • 159
0 votes
1 answer
160 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 ...
user avatar
  • 115
0 votes
0 answers
286 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" ...
user avatar
2 votes
2 answers
672 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 ...
user avatar
0 votes
2 answers
2k 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 ...
user avatar
6 votes
3 answers
3k 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 ...
user avatar
0 votes
1 answer
6k 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 "{\"...
user avatar
-2 votes
4 answers
768 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 ...
user avatar
-1 votes
1 answer
83 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 ...
user avatar
4 votes
2 answers
3k 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-...
user avatar
  • 313
1 vote
3 answers
9k 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 ...
user avatar
  • 111
-1 votes
1 answer
623 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 ...
user avatar
1 vote
1 answer
332 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 ...
user avatar
16 votes
3 answers
35k 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 ...
user avatar
  • 1,305
1 vote
1 answer
414 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?
user avatar
  • 211
2 votes
3 answers
3k 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 ...
user avatar
  • 1,305
3 votes
1 answer
703 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 ...
user avatar
0 votes
1 answer
951 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, ...
user avatar
  • 227
1 vote
4 answers
2k 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 ...
user avatar
  • 1,305