-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Brackets incorrectly identify a file as being non-encoded in utf-8 and refuse to open it #11525
Comments
could you upload the file here. |
@abose Apparently I can not upload the file; however here is a link to it on github: |
Did some testing, any file that:
fails to be recognized as UTF-8. Adding any other characters (including new lines etc.) except spaces or converting the file to UTF8 with BOM fixes the problem. Some test cases (take a line, remove the comment, save as anyfile.anyext UTF without BOM)
|
@petetnt Thanks for looking into this very weird issue. |
It's the According to MSDN:
I guess we're seeing some sort of this bug. |
Btw: Would Brackets save it's files with a BOM, this would not be an issue at all... |
@marcelgerber Let me do some reading on this. I will get back to you. Thanks! |
@marcelgerber RE: Saving files with BOM, When I was looking into this I noticed that UTF-8 & BOM has been under discussion for a long time in #3898 (and others such as #10583) plus there is this card on Trello too: https://trello.com/c/I5sgI4SV/1164-editor-and-bom-byte-order-mark |
@marcelgerber You were right about the @petetnt Thanks for trying out various steps in nailing down the problem. Saving with BOM seems to be a good idea. Unfortunately, that is not a recommended way. By the way, we have already started to think about what are the best ways to support various encodings. I will keep you updated on that. Thanks! |
@nethip Notepad++ has a good encoding detection, which is not ultra-long at least (it's not by any means comprehensble, but I guess that's simply the nature of encodings): As it's all licensed under the GPL, we could completely reuse their implementation. |
Can't comment on Notepad++'s method from a technical perspective, but in practice N++ has worked as an general "solve this encoding problem" workhorse for me for years. 👍 |
@marcelgerber Thanks for the pointer. It looks like a good place to start this activity. Hopefully, we will be able to map Win32 calls in the repo to their Mac and Linux equivalents. |
Yes, they have a solid detection rate. A working encoding detection is also the foundation for multi-encoding support, so it doesn't interfere with those efforts at all. |
I have a very simple json file whose entire content is
Bracket refuses to open it, claiming it is not a utf-8 encoded file. Notepad++ identifies it as being a utf-8 encoded file (with no BOM).
The text was updated successfully, but these errors were encountered: