XhmikosR / notepad2-mod

LOOKING FOR DEVELOPERS - Notepad2-mod, a Notepad2 fork, a fast and light-weight Notepad-like text editor with syntax highlighting
https://xhmikosr.github.io/notepad2-mod/
Other
1.45k stars 270 forks source link

Saving an empty UTF-8 .txt file converts it to ANSI #26

Closed klonos closed 11 years ago

klonos commented 12 years ago

Steps to reproduce:

  1. By default windows creates .txt files in ANSI encoding. Create one by using built-in notepad.
  2. Open the file created in step 1 with notepad2-mod.
  3. Change it's encoding to UTF-8 (file -> encoding -> UTF-8)
  4. Save the file and close it.
  5. Open the file.

Expected result: the file should be in UTF-8 Actual result: the file is reverted to ANSI

Another way:

  1. Create a file with notepad. It will be in the default ANSI encoding.
  2. Open the file with built-in notepad and save as UTF-8 replacing the old one.
  3. Close the file.
  4. Open it with notpad2-mod. The file is in UTF-8.
  5. Close the file without editing it.
  6. Open the file again with notepad2-mod. The file is still in UTF-8.
  7. Edit the file (type a few chars will do) and close/save.
  8. Open the file.

Expected result: the file should be in UTF-8 Actual result: the file is reverted to ANSI

XhmikosR commented 12 years ago

Unless a patch is provided nothing can be fixed. And/or Report it to the Notepad2 developer.

zufuliu commented 12 years ago

Windows notepad save file as UTF-8 with BOM (or "UTF-8 Signature" in Notepad2), other than "UTF-8" in Notepad2.

XhmikosR commented 12 years ago

Still. No patch, no joy.

QWp6t commented 11 years ago

The point of the signature is to let editors know that it's UTF-8 encoded when there are no multi-byte characters. Whether it defaults to UTF-8 or ANSI in such instances where it is otherwise impossible to tell is already a setting in Notepad2.

Go to File->Encoding->Default and choose UTF-8 from the dropdown.

This also means that if you save a blank file as ANSI, it will now be opened as UTF-8.

Again, though, if you want to avoid these problems of it not being able to tell how to encode the file, then use UTF-8 with signature. That's the point of the signature.

QWp6t commented 11 years ago

@XhmikosR shouldn't this be closed and marked as "invalid" as explained above? Or is there something I'm missing?

XhmikosR commented 11 years ago

I guess so, yes.