Ted:

I am using vim, but when I attempt to write the UTF-8 file which I saved from the internet browser cut and paste command, into ascii format, vim fails with a curious error

vim command:

:write ++enc=ASCII my_ascii_file.txt

I get the following error:

"my_ascii_file.txt" E513: Write error, conversion failed (make 'fenc' empty to override)
WARNING: Original file may be lost or damaged
don't quit the editor until the file is successfully written!
Press ENTER or type command to continue

And trying to internally set the values of encoding and file encoding seems to work

:set encoding=ascii

:set fileencoding=ascii

except when you double check the encoding, it stays at utf-8

but the fileencoding appears to be changed to the new value=ascii

But then when you attempt to overwrite the file or write to a new file, vim throws errors again

"new_file.txt" E513: Write error, conversion failed (make 'fenc' empty to override)
WARNING: Original file may be lost or damaged
don't quit the editor until the file is successfully written!
Press ENTER or type command to continue

So I am unable to get linux vim version 9.1.83 to work to change the encoding.

I had to actually use notepadqq to paste the browser text and then set the encoding to ascii and this seems to work.

I suppose you could pipe the file and let tr strip off the non-ascii characters ??? But this means going back in and manually comparing the two files, to see how to fix the omitted characters (if possible)

TexStudio crashed mysteriously when I turned off its internal file scanning so I had to set the option again.

Supposedly there is some tex sty code which allows UTF-8 to be used in a tex file. And yes, my editor settings under TexStudio IS UTF-8

I already have used up at least an hour of time on this problem as iconv doesn't really change a pure ascii file into a UTF-8 file and vim was failing me.

Randall

On 12/25/25 11:28, Ted Mittelstaedt wrote:
Open the regular textedit, paste into there, save, open the saved file in 
TexStudio

Ted

-----Original Message-----
From: PLUG <[email protected]> On Behalf Of American Citizen
Sent: Wednesday, December 24, 2025 7:40 PM
To: Portland Linux/Unix Group <[email protected]>
Subject: [PLUG] Ascii versus UTF-8 woes

Hi:

I have a set of tex files which are in pure ascii format. Unfortunately when I 
copy material from the internet (Mozilla Firefox browser) it is in UTF-8 
format, not ascii. This appears to be standard behavior for the internet 
browsers.

When I paste the material into the tex document (using TexStudio) the paste 
goes okay. It only blows up when I try to save the newer file. The
UTF-8 characters cannot be saved in ascii format and for some bizarre reason 
Tex Studio wont' change the encoding to UTF-8 even though I have the option set 
that the editor is working with UTF-8 character set.

iconv won't work either, I do the "iconv -f ASCII -t UTF-8 input_file -o 
output_file and the file remains ascii.

Does anyone have an idea of how I can get TexStudio to wake up and change the 
file encoding on the current ascii file to UTF-8?

I cannot get iconv to change the ascii file to UTF-8, so I am stuck between the 
devil and the deep blue sea.

Randall



Reply via email to