Questions tagged [character-encoding]

Character encoding refers to the way characters are represented as a series of bytes

Filter by
Sorted by
Tagged with
14
votes
4answers
7k views

How to input special character, such as Celsius symbol, and common greek letters?

I want to input: Celsius degree symbol Common Greek letter: Alpha, Theta, Omega
12
votes
3answers
6k views

How to display Unicode UTF-8 as Unicode?

I have some UTF-8-encoded text files which display strange escape codes in Emacs. For instance, this text: In ista quaestione primo exponam quid intelligendum est per hoc nomen ‘Deus’; secundo, ...
9
votes
1answer
526 views

How to get human language-specific numerals?

TL;DR: how can I use Hindi digits (١٢٣...) when writing in Arabic? Emacs is arguably hailed as the best editor, but when it comes to using numerals in the context of writing there are no satisfactory ...
9
votes
3answers
1k views

Package manager encoding error

Upon running package-list-packages, I get the following error. These default coding systems were tried to encode text in the buffer ` *temp*': (iso-latin-1-dos (3242 . 37326) (3243 . 40165)) ...
9
votes
2answers
571 views

How to change octal sequences into utf-8 text

When I copy non-ascii text from Windows and paste into Emacs, it shows up as an octal sequence. For example, if I paste ä into Emacs it shows up as \344. I could type C-q 344 to get the ä back in ...
9
votes
1answer
1k views

Coding System utf-8 on Mac - Which one and why as default?

I want to change my default encoding system from non defined to UTF-8 (I think that would be useful). Now I have seen many different UTF-8 coding systems: mule-utf-8 mule-utf-8-dos mule-utf-8-...
8
votes
3answers
1k views

Using UTF8 encoding as default when writing emails

When I want to send an email I composed in Emacs, I press C-c C-c and am always presented with such an error message: These default coding systems were tried to encode text in the buffer `2015-02-...
8
votes
3answers
4k views

Set default coding system = UTF-8

Windows 10 (64 bit), Emacs 25.1 I want when I save any file to save them (by default) with coding system = UTF-8. So In my init.el I has : (prefer-coding-system 'utf-8) (set-default-coding-systems '...
7
votes
3answers
5k views

How convert txt file to UTF-8 from Windows-1251?

Windows 10, Emacs 25. When I want to convert file from Windows-1251 to UTF-8 I use Notepad++. Before convert: convert: after convert: My question is: Is it possible this convert in Emacs?
7
votes
1answer
1k views

Emacs is asking me for a coding system on each save

I consolidated many text files (win, mac, unix) into a single orgmode file. For some characters I was seeing numbers instead of the right characters. Things like \314\203. I used "revert-buffer-with-...
7
votes
3answers
1k views

単 does not show up in Emacs, how to fix?

I'm editing a text file containing Japanese kanji characters. 単 does not show up in Emacs, how to fix? It shows up as some sort of white space. Update: I'm using GNU Emacs 24.3 (9) for Mac. After ...
6
votes
2answers
2k views

How to insert invalid UTF-8 sequence

In order to test that some code handles an invalid UTF-8 sequence properly, I need to insert an invalid UTF-8 sequence into an existing text file. However, my attempts to do so result in a valid UTF-...
6
votes
2answers
185 views

Key bound to string does not handle some chars in string correctly

(I ask this question after reading this one.) The form (global-set-key (kbd "M-e") "e") is, as far as I can tell, equivalent to (global-set-key (kbd "M-e") (lambda () (interactive) (insert "e"))) ...
6
votes
1answer
216 views

How do I find out which input modes include a specified uft-8 character?

Using the input mode latin-1-prefix I can enter "~a" which gives me "ã". I am looking for a similar way to enter the characters "āēīōū" (vocals with bars). So my question is: What input mode does ...
6
votes
1answer
318 views

Why must I set and reset `buffer-multibyte` to correctly view multibyte buffers?

In an ongoing project, we are inserting multibyte text into a buffer and experiencing strange behavior. When the question is first viewed, we receive something like: Quote Environment à la Strunk\...
6
votes
1answer
276 views

Check if terminal supports Unicode

I would like to use special mark symbols not only in window-system but also in xterm: (setq gnus-summary-to-prefix (if window-system "▒ " "==> ")) What check I should use?
6
votes
1answer
1k views

How can I save UTF-8 files with a Byte Order Mark?

I am trying to configure Emacs to save UTF-8 files with a Byte Order Mark. (Yes, I know that the BOM is evil and unnecessary for UTF-8 files. However, Microsoft has decided they know better, so I want ...
5
votes
2answers
244 views

How many bytes are in the region?

After far too many years of counting the number of characters in the region by doing M-: (- (point) (mark)), I just discovered M-= (count-words-region). Much better! But now I'm looking for a way to ...
5
votes
1answer
363 views

Handling text files with mixed encodings

I created a text file by copying its different parts from different sources (webpages, other text files, pdf files) into gedit and saved it to the file. I wonder if that is the reason why I may have ...
5
votes
1answer
976 views

Character encoding when copying some text from somewhere to Emacs and saving to a file

Suppose I copy some text from a source (e.g. a webpage, a text file opened in an editor such as gedit or emacs) to a buffer in emacs, and then save the buffer to a text file. When I copy the text ...
5
votes
2answers
2k views

How to strip invalid UTF-8 characters from a string?

TL;DR: I have a string with characters that are unencodable in UTF-8, and I need to remove these characters before writing the string to a file. For instance, the following snippet creates a file ...
5
votes
2answers
1k views

Emacs doesn't let me exit without selecting a coding system

Sometimes to speed up of opening an emacs' eshell directly from terminal (in my case from MS DOS prompt), I do emacs -Q -f eshell. But when I try to exit emacs doesn't let it, unless I give some input ...
5
votes
1answer
512 views

UnicodeDecodeError in my Inferior Python buffer

While trying to run a python script in an Inferior Python buffer for Python 3.3.5 in my Emacs 24.3.1 GTK+ window, I get a >>> Traceback (most recent call last): File "<stdin>", line ...
5
votes
2answers
568 views

Org-mode timestamps encoding

I love org-mode. It's main reason why i switched from vim. It's really interesting to write reports using Literate Programming. I try to use TODO, agenda etc. to be more productive. I was able to ...
5
votes
0answers
2k views

Emacs IPython prompt symbol is garbled

I just installed Fedora 24 with Emacs and IPython. When I launched the IPython shell in Emacs, the prompt symbol, which should be "In [1]", is displayed as "^[[?12l^[[?25h". Is there a way to solve ...
4
votes
1answer
362 views

Encoding issue for French text

My problem: With my Emacs 26.1 on my 10.13.6 Mac, I have a opened a third-party text file, and it turns out I have the wrong encoding set : the text is in French , and the accentuated characters are ...
4
votes
2answers
218 views

How can I find non-displayable unicode characters in a buffer?

I mean these: I'd like to remove them, so I'm looking for a function which can find all these characters in the buffer which cannot be displayed properly with the current font and therefore show up ...
4
votes
1answer
534 views

How to set the coding system for new files with specific extensions

When I visit a new file, ^xf, that has an extension of .sql or .dsql I would like the coding system to be set to utf-8-with-signature-dos. The default is currently iso-latin-1-dos. I'm running (...
4
votes
1answer
164 views

Invalid coding system: auto-save-coding when trying to recover auto-save files

Sometimes when I try to run recover-this-file I get an error Invalid coding system: auto-save-coding which prevents the file from being recovered. I had to manually find the autosave file and copy ...
4
votes
2answers
291 views

Advice on setting shell's character set

M-x shell has been my friend for decades, and I've always been comfortable even sympathetic with his insistence on being a dumb terminal (i.e. TERM=dumb). But recently I've found my self setting ...
4
votes
0answers
186 views

Shell coding system

If, before M-x shell, I run C-x RET c (universal-coding-system-argument) I can change the coding system used by the shell. Therefore, given echo Straße > foo foo will be encoded in the related ...
4
votes
1answer
456 views

Under Windows, Emacs cannot handle encodings correctly for subprocesses, can it?

I have two simple text files on my D: drive, as shown below. D:\我.txt I D:\你.txt You After I execute M-x diff and type the correct filenames (Yes, I can input Chinese and filename ...
4
votes
0answers
653 views

How do I change permanently the encoding of a text file?

I have a bunch of html files encoded as iso-8859-1-unix and a few encoded in utf-8-unix. What I want is to encode all of them in utf-8-unix. I have already tried (I think they are the same command, ...
3
votes
1answer
1k views

Open Russian file names on windows?

In emacs on Windows 8.1 I can't open a file if its full name contains Russian letters [and generally any non-ascii char]. For example, if I try to open D:\ББББ\test.txt I get: I find a config which ...
3
votes
1answer
766 views

Unicode characters with same font produce different results in GUI and terminal

While I'm able to display the cute little snowman ☃ in both GUI and terminal I'm not able to display these unicode characters in the terminal although it works in the GUI : Ⓐ Ⓑ ... I've got the usual ...
3
votes
1answer
210 views

How can I always open a file with a certain coding system?

I'm trying to open the edict2.gz file from http://www.edrdg.org/jmdict/edict_doc.html which is a japanese->english dictionary so first I changed the extension to .txt. Currently there are many ...
3
votes
1answer
89 views

Encoding in buffers not associated with files

I use Magit to manage Git repositories. Some of these repositories have collaborators whose names contain accented characters. In a freshly-started Emacs, everything looks fine. In a long-running ...
3
votes
2answers
289 views

Pasting Text from Clipboard - why ^M instead of linebreaks?

I'm using some VBA scripts which copy Text in MS Outlook from an e-mail message and send it to the clipboard. If I then paste the clipboard content with Ctrl-Y in Emacs 24.5.1 in Windows 7, the ...
3
votes
0answers
167 views

Emacs keeps guessing wrong coding system on a file I edit both in Linux and Windows

I use Emacs on both Linux and Windows to edit the same files (that I keep in Dropbox, which I hope is irrelevant, but who knows). The files are encoded in utf-8 with Unix line endings. Occasionally, I ...
2
votes
2answers
830 views

How encode to UTF-8 content of buffer?

Windows 10, Emacs 25.1 When I open file that not encoding in UTF-8 I get the next incorrect result: I try by command set-buffe-file-coding-system but it not help. And here result: As you can see ...
2
votes
1answer
237 views

How to query/set the character encoding?

How can I find out what character encoding Emacs employs in saving a text file to disk? And how can I specify this encoding? Operating system: macOS Sierra, Version 10.12.5 Emacs: GNU Emacs 25.1.1
2
votes
3answers
1k views

How to get rid of BOM (byte order mark)

How can I open a file with a BOM Byte Order Mark and ensure that BOM is gone when I save the file.
2
votes
1answer
108 views

How to delete ^M in the diffs of Magit?

I had an issue with a file that had inconsistent line ending. My file would show a ^M for every line ending. I ran into this article that shows how to get rid of the ^M character and set the buffer ...
2
votes
1answer
160 views

Strange encodings in ORG mode with German umlaute

I have a few org files encoded in UTF-8. Everything works fine, also with German umlaute (ä, ö, ü, ß). These files I sync with Git between different PCs (mostly running Debian). When I synced one of ...
2
votes
2answers
858 views

How to set default encoding to utf-8, and default line ending to linux style?

I use this piece of code to set the default line ending to linux-style \n ;; https://www.emacswiki.org/emacs/EndOfLineTips (add-hook 'find-file-hook 'find-file-check-line-endings) (defun dos-file-...
2
votes
1answer
774 views

What does `mac` in `utf8-mac` mean?

In Emacs, I show the newline convention used by emacs for the current file, by M-x describe-variable, then buffer-file-coding-system. The result is utf8-mac. Does mac, dos, unix after the hyphen ...
2
votes
1answer
209 views

Quail Rules UTF8 behaviour

I had inserted the following code in .emacs: (quail-define-package "LaTeX-UTF-8" "TeX" "TeX") (quail-defrule "α" ["\\alpha"]) what I want to do is the following: when I insert the character "α" (I ...
2
votes
1answer
214 views

Unicode and `url-unhex-string` and something like \345\205\266\344\273\226

I need to use Emacs built-in url.el url-unhex-string to decode uri (e.g. /%E5%85%B6%E4%BB%96/other) It works, but all non-ascii (I guess it should be Unicode) characters are all converted into ...
2
votes
1answer
63 views

How to have a buffer interpret C-m as an actual carriage return

I'm using the following elisp snippet in a dedicated buffer to track progress of a wget download. (with-current-buffer buf (setq proc (apply 'start-process "my-download" buf (list "wget" (...
2
votes
2answers
139 views

Opening file with emacsclientw, file name contains non-latin characters

My first post here about Emacs. I've spent days trying to figure out answer before posting here. I'm running Emacs 26.1 on Windows 10. The setup that I'd like to have is running a single instance of ...