Sunday, July 18, 2021

Re: Conversion Error

Hi Robert,

On Sunday, 2021-07-18 06:18:36 -0700, Robert Solomon wrote:

> I often copy-paste from a browser into a text file to save the content I
> come across. When I try to save the file, I often get a conversion error.
> I have to manually go thru each error and change the extended character to
> an ascii one.

Likely the text pasted from clipboard is in a different text encoding
(usually UTF-16 on Windows) than the file is saved in, and the file's
text encoding can't represent all characters. Issue the command

:set fenc?

that displays the current fileencoding. To be on the safe side choose an
encoding that can represent all Unicode characters, common is UTF-8.

So,

:set fileencoding=utf-8

before saving.

Best have encoding (taken from current locale) and fileencoding aligned
set to utf-8, but things may be more complicated on Windows. See
https://vim.fandom.com/wiki/Working_with_Unicode and the help sections
it references.

Eike

--
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
Use LibreOffice! https://www.libreoffice.org/

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/YPSYqcUUtiPDhYB4%40kulungile.erack.de.

No comments: