help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Special Characters


From: Yuri Khan
Subject: Re: Special Characters
Date: Wed, 12 Aug 2015 10:19:23 +0600

On Tue, Aug 11, 2015 at 11:55 PM, Ian Baylis <address@hidden> wrote:
> Thanks for the reply. Is there a list that contains all the octal
> representations of characters like \342\200\231?

If you’re interested, you might want to read a description of the
UTF-8 encoding, then browse the Unicode charts.

http://tools.ietf.org/html/rfc3629
http://www.unicode.org/charts/


However, I must ask: Why do you want to know? Are you going to
hand-decode files that come your way? Why not delegate that work to
computers?

There are many different character encodings. When people or software
do not agree on which one they use, misdecoding occurs. With some
experience, one can make an accurate guess at which encoding was used
originally, although this becomes less necessary as we migrate to
UTF-8.


PS: please don’t top-post.

> On Aug 11, 2015 1:22 PM, "Yuri Khan" <address@hidden> wrote:
>>
>> On Tue, Aug 11, 2015 at 7:37 AM, Ian Baylis <address@hidden> wrote:
>> > I have a file that has special characters in it.   When I open the file
>> > in Emacs an ' is represented like:
>> > \200\231 or just \231
>>
>> The Unicode apostrophe ’ (U+2019 Right single quotation mark) is
>> encoded in UTF-8 as a sequence of three bytes, whose octal
>> representation is \342\200\231 (or hexadecimal E2 80 99).
>>
>> If your Emacs incorrectly picks e.g. the ISO-8859-1 (aka Latin-1)
>> encoding for this file, you will see the letter â (U+00E2 Latin small
>> letter a with circumflex), followed by two codes \200 and \231,
>> because those do not correspond to printable characters in Latin-1.
>>
>> In order to view the file as intended, you need to re-open that file
>> using the correct encoding (UTF-8). Eli has given you the command:
>>
>> C-x RET c utf-8 RET C-x C-f FILE-NAME RET
>>
>> Alternatively, if you already have a buffer visiting the file, you can
>> revert it using the correct encoding:
>>
>> C-x RET r utf-8 RET (you might need to confirm the revert).
>>
>> You then need to evaluate how often you use files in encodings other
>> than UTF-8. If rarely, you might want to set UTF-8 as your default
>> encoding.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]