It is possible to use hex values in "sed".

echo "Ã" | hexdump -C
00000000  c3 83 0a                                          |...|
00000003

Ok, that character is two byte combination "c3 83". Let's replace it with single byte "A":

echo "Ã" |sed 's/\xc3\x83/A/g'
A

Explanation: \x indicates for "sed" that a hex code follows.

Answer from ajaaskel on Stack Overflow
Discussions

Replace unicode characters with useful ascii characters
Hello everybody, I'm facing the challenge to replace (periodically) unicode characters from UTF8-coded files into useful ascii characters in order to store them in an ISO database. My first idea was working with a database translation table. But a large DBTT results in poor performance. Additi... More on community.rocketsoftware.com
🌐 community.rocketsoftware.com
0
October 5, 2023
ascii - Search and replace unicode character codes with actual characters - Vi and Vim Stack Exchange
I've got a text file with unicode character codes in it. It looks like this in vim (utf-8[unix]): Samuel i ngel - Euro 25 Tomas i lvaro - ©Coca-Cola and dagger More on vi.stackexchange.com
🌐 vi.stackexchange.com
March 8, 2023
How to REPLACE a known Unicode character by another (ASCII) character in Word 2016
There are actually at least three ... quote (ASCII 148). Some fonts, but not all, also include "smart" quotes at Unicode hex values 201C and 201D (the decimal values 8220 and 8221 that you found). The AutoCorrect Options > AutoFormat As You Type option to replace "straight quotes" with "smart quotes" ... More on answers.microsoft.com
🌐 answers.microsoft.com
4
3
October 9, 2017
java - Unicode Replacement with ASCII - Stack Overflow
I have created a text file on windows system where I think default encoding style is ANSI and contents of the file looks like this : This is\u2019 a sample text file \u2014and it can .... I saved ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Rocketsoftware
community.rocketsoftware.com › home › sitemap › product forums › uniface® › uniface® forum home › replace unicode characters with useful ascii characters
Replace unicode characters with useful ascii characters | Rocket Forum
October 5, 2023 - I did some testing with iconv and the //TRANSLIT option on solaris. But unfortunately all I've tested hasn't met my purposes. :-( During my research I've found the site https://www.baeldung.com/linux/utf-8-ascii-conversion. From there I tried the call of · $ iconv -f UTF-8 -t ASCII//TRANSLIT input_utf8.txt -o output_ascii.txt · The output shown will have the encoding in ASCII format, including the transliterated character, such as all 'ç' characters being altered to 'c'.
🌐
GitHub
github.com › rich-iannone › unidecoder
GitHub - rich-iannone/unidecoder: Replace Unicode characters with sensible US-ASCII equivalents · GitHub
Use the unidecoder package's function unidecode() to transform text to ASCII. The function takes in a vector of strings and replaces Unicode characters with their best equivalents.
Starred by 66 users
Forked by 5 users
Languages   R
🌐
w3tutorials
w3tutorials.net › blog › how-to-replace-unicode-characters-with-ascii
How to Replace Unicode Characters with ASCII Using Sed: Using Hexadecimal Values in Unix Environment — w3tutorials.net
By default, sed works with ASCII, but it can manipulate raw bytes using hexadecimal escapes (e.g., \xHH, where HH is a two-digit hex value). This is critical for targeting multi-byte Unicode sequences. Unicode characters in UTF-8 are stored as 1–4 bytes. For example: ... Identify the UTF-8 hex bytes of the Unicode character. Use sed to replace those hex bytes with the ASCII equivalent’s hex bytes (or text).
🌐
GitLab
gitlab.com › gitlab.org › merge requests › !39971
Replace Unicode Characters with ASCII Equivalent in New Project Slug (!39971) · Merge requests · GitLab.org / GitLab · GitLab
Kevrequested to merge KevSlashNull/gitlab:29642-Replace-Unicode-with-ASCII-Equivalent into master Aug 20, 2020 ... This adds a text_utility JS helper method called convertUnicodeToAscii which converts (some) unicode characters (Latin 1 Supplement -> Letters: Uppercase & Lowercase and Latin Extended A \ Deprecated) to their ASCII equivalents.
🌐
2manyrobots
2manyrobots.com › YateResources › docs › ReplaceUnicodeCharacters.html
Replace Unicode Characters
A sample Unicode Replacements set is supplied. The supplied set changes single and double quote variants to their standard ASCII/ISO-88591-1 (ISO-Latin-1) equivalents. This action is intended to replace Unicode characters with ASCII or Latin-1 (ISO8859-1) characters.
Find elsewhere
🌐
Delft Stack
delftstack.com › home › howto › python › python unicode to string
How to Convert Unicode Characters to ASCII String in Python | Delft Stack
February 2, 2024 - In this case, the characters ä and å are replaced with a, and the resulting string is b'Har ar ett exempel pa en svensk mening att ge dig.'. The byte literal can be further decoded to obtain a plain ASCII string if needed. In order to remove the symbol and the single quotes encapsulating the string, call the function decode() after calling encode() to re-convert it into a string literal. import unicodedata stringVal = "Här är ett exempel på en svensk mening att ge dig." print(unicodedata.normalize("NFKD", stringVal).encode("ascii", "ignore").decode())
Top answer
1 of 4
4

Word plays internal tricks with Unicode symbols, and doesn't report the true character values. To make successful replacements, use the macros in the article https://wordmvp.com/FAQs/MacrosVBA/FindReplaceSymbols.htm.

2 of 4
0

Hi Jay,

Thank you very much - the macros in the article worked just great!

This was the first time I ever dabbled with VBA in Word, and this worked almost first time. (I do have quite a lot of experience writing VBA macros in Excel, but never in Word.)

Something I learned from using these macros for my specific case - to find and replace all the ?-in-a-rectangles with a regular double quote - is that, in Word t,here is a difference between an opening double quote mark and a closing double quote mark.

At first I highlighted a double quote mark in my document (by chance, a closing one), and used the code that the first macro returned to replace ALL of the ?-in-a-rectangles. This caused the Word spelling & grammar checker to complain that, for all the replaced opening quotes, the adjacent space should go after the quote character. This made me realize that the opening & closing quotes had different codes, though in my document they looked the same. Only when I enlarged the font, was a difference between them discernable.

Also, only the opening ?-in-a-rectangle was replaced by the closing ".  This made me very suspicious, so I used the first macro to display the code of the closing ?-in-a-rectangle - it also was different from the opening character code, which is what I'd used in the second macro.

So I undid all the replacements, and ran the second macro again, twice, each time with the corresponding codes for the opening & closing characters. (8220 --> 147, 8221 --> 148, all (normal text) font)

This time the result was perfect.

many thanks!.

🌐
Peterbe.com
peterbe.com › plog › unicode-to-ascii
Unicode strings to ASCII ...nicely - Peterbe.com
There's now the "unidecode" package that does all the job http://pypi.python.org/pypi/Unidecode/ >>> from unidecode import unidecode >>> utext = u"œuf dür" >>> unidecode(utext) u'oeuf dur' >>> from unicodedata import normalize >>> normalize('NFKD', utext).encode('ascii','ignore') 'uf dur' A better support for special latin extended characters (French, German) that should tranlitterate to multiple ASCII characters.
🌐
Finxter
blog.finxter.com › home › learn python blog › 7 best ways to remove unicode characters in python
7 Best Ways to Remove Unicode Characters in Python - Be on the Right Side of Change
April 17, 2023 - 😊 · One way to remove Unicode characters is to use the built-in string encoding and decoding methods, encode() and decode() (PythonPool). To do this, you can encode the Unicode string to ASCII and then decode it back, effectively removing ...
Top answer
1 of 2
10

Match the escape sequence \uXXXX with a regular expression. Then use a replacement loop to replace each occurrence of that escape sequence with the decoded value of the character.

Because Java string literals use \ to introduce escapes, the sequence \\ is used to represent \. Also, the Java regex syntax treats the sequence \u specially (to represent a Unicode escape). So the \ has to be escaped again, with an additonal \\. So, in the pattern, "\\\\u" really means, "match \u in the input."

To match the numeric portion, four hexadecimal characters, use the pattern \p{XDigit}, escaping the \ with an extra \. We want to easily extract the hex number as a group, so it is enclosed in parentheses to create a capturing group. Thus, "(\\p{XDigit}{4})" in the pattern means, "match 4 hexadecimal characters in the input, and capture them."

In a loop, we search for occurrences of the pattern, replacing each occurrence with the decoded character value. The character value is decoded by parsing the hexadecimal number. Integer.parseInt(m.group(1), 16) means, "parse the group captured in the previous match as a base-16 number." Then a replacement string is created with that character. The replacement string must be escaped, or quoted, in case it is $, which has special meaning in replacement text.

String data = "This is\\u2019 a sample text file \\u2014and it can ...";
Pattern p = Pattern.compile("\\\\u(\\p{XDigit}{4})");
Matcher m = p.matcher(data);
StringBuffer buf = new StringBuffer(data.length());
while (m.find()) {
  String ch = String.valueOf((char) Integer.parseInt(m.group(1), 16));
  m.appendReplacement(buf, Matcher.quoteReplacement(ch));
}
m.appendTail(buf);
System.out.println(buf);
2 of 2
7

If you can use another library, you can use apache commons https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringEscapeUtils.html

String dirtyString = "Colocaci\u00F3n";
String cleanString = StringEscapeUtils.unescapeJava(dirtyString);
//cleanString = "Colocación"
🌐
GeeksforGeeks
geeksforgeeks.org › python › convert-unicode-to-ascii-in-python
Convert Unicode to ASCII in Python - GeeksforGeeks
July 23, 2025 - This article deals with the conversion of a wide range of Unicode characters to a simpler ASCII representation using the Python library anyascii.
🌐
GitHub
gist.github.com › wires › 1373830
Replace ASCII by unicode symbols in emacs · GitHub
Replace ASCII by unicode symbols in emacs · Raw · pretty-mode.el · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
🌐
GitHub
gist.github.com › ruudud › 7193993
Replace special unicode characters (e.g. ❤) with code points in ASCII (e.g. \2764). Written with CSS in mind.
Replace special unicode characters (e.g. ❤) with code points in ASCII (e.g. \2764). Written with CSS in mind. - unicode-to-unihex.sh
🌐
Stack Overflow
stackoverflow.com › questions › 21981247 › how-to-replace-ascii-characters-by-unicode-characters › 21981537
java - How to replace ascii characters by unicode characters? - ...
I get one String from properties file in which uni-code is stored as -uni-000A which is actually \u000A. When I write this \u000A in another file I want to write its corresponding unicode character...