Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to open binary files in the text editor as explicit user gesture #1218

Closed
freezestudio opened this issue Dec 12, 2015 · 14 comments
Closed
Assignees
Labels
feature-request Request for new features or functionality file-encoding File encoding type issues on-testplan workbench-editors Managing of editor widgets in workbench window
Milestone

Comments

@freezestudio
Copy link

When I install GitHub Windows client, it generates an error, error details recorded in the

X: \ Users \ xxx \ AppData / Local \ Temp \ VSD75A.tmp \ install.log

File, I use vscode open it, but to give tips:

The file can not be dispalyed in the editor because it is either binary, very large or uses an unsupported text encoding.

Another: Use sublime text or notepad turns on properly.
Shall not, with a hex editor to open were compared and found need to start BOM information (FF EF or EF FF) vscode open file required documents, but did not use UTF8 encoding BOM information can also be opened.

Another: The install.log encoding format to Unicode text files, the file size is 9kb.

@egamma egamma added feature-request Request for new features or functionality bug Issue identified by VS Code Team member as probable bug and removed feature-request Request for new features or functionality labels Dec 12, 2015
@egamma egamma added this to the Backlog milestone Dec 12, 2015
@bpasero
Copy link
Member

bpasero commented Dec 12, 2015

@freezestudio can you attach the file please?

@bpasero bpasero modified the milestones: Dec 2015, Backlog Dec 12, 2015
@freezestudio
Copy link
Author

GitHub Setup error log file:
this rename .log to .txt:
install.txt

@bpasero
Copy link
Member

bpasero commented Dec 13, 2015

The file is containing null bytes which we then detect as binary type. However the file seems to use UTF 16 as encoding. We only support that if the file has a BOM in the beginning. I think other editors just try to open the file with UTF 16 if they detect null bytes but this can also fail.

I think we should allow to change the encoding from the editor in all cases even if we think the file is binary.

@bpasero bpasero modified the milestones: Backlog, Dec 2015 Dec 13, 2015
@bpasero bpasero removed their assignment Dec 13, 2015
@bpasero bpasero added feature-request Request for new features or functionality and removed bug Issue identified by VS Code Team member as probable bug labels Dec 13, 2015
@bpasero bpasero changed the title Open an extended range of recommendations common text files Allow to change the encoding for files that seem to be binary Dec 13, 2015
@bpasero bpasero added workbench file-explorer Explorer widget issues and removed workbench labels Dec 18, 2015
@bpasero bpasero self-assigned this Mar 30, 2016
@bpasero bpasero removed their assignment Aug 17, 2016
@iffy
Copy link

iffy commented Apr 12, 2017

This one feature prevents us from using VS Code here at work. We often have Markdown files with embedded null bytes (and other non-printable characters).

@bpasero
Copy link
Member

bpasero commented Apr 12, 2017

@iffy may I ask why your markdown files contain null bytes?

@iffy
Copy link

iffy commented Apr 12, 2017 via email

@bpasero
Copy link
Member

bpasero commented Apr 12, 2017

Ok, I think having a way to force open a file that we think is binary is still valid. E.g. similar how for large images we ask you to open them externally there could be a link to force open them inside the editor:

image

I would accept a PR on such a solution 👍

@bpasero bpasero added the help wanted Issues identified as good community contribution opportunities label Apr 12, 2017
@iffy
Copy link

iffy commented Apr 17, 2017

I tried... I changed it to add a button labeled "Open anyway" but since this code base is enormous and unfamiliar, I have no idea what function to call to open a file, let alone with an explicit encoding :) Somewhere down the openFileFolderPicker -> open(IOpenConfiguration) chain....

@bpasero
Copy link
Member

bpasero commented Apr 17, 2017

Yeah sorry, the code is quite complex. You could start to debug through how editors open e.g. by adding a breakpoint to editorPart.openEditor(). I think for this to work we need a way to "force" open a binary file as text, even if our check returns that it is a binary file (here).

@zaus
Copy link

zaus commented Jun 9, 2017

@bpasero what about a couple lines up options.acceptTextOnly? How can we turn that off?

@bpasero
Copy link
Member

bpasero commented Jun 10, 2017

There should probably be a way to control this when opening that file to override.

@isidorn isidorn added file-encoding File encoding type issues and removed file-explorer Explorer widget issues labels Nov 17, 2017
@bpasero bpasero removed the help wanted Issues identified as good community contribution opportunities label Nov 17, 2017
@bpasero bpasero removed their assignment Nov 17, 2017
@bpasero bpasero removed this from the Backlog milestone Nov 17, 2017
@bpasero bpasero added workbench-editors Managing of editor widgets in workbench window file-encoding File encoding type issues and removed file-encoding File encoding type issues labels Nov 17, 2017
@zaus
Copy link

zaus commented Nov 30, 2017

Could we just have a setting to always open whatever we tell it to open? Don't worry about protecting me from myself... ;)

@conioh
Copy link

conioh commented Dec 20, 2017

The file is containing null bytes which we then detect as binary type. However the file seems to use UTF 16 as encoding. We only support that if the file has a BOM in the beginning. I think other editors just try to open the file with UTF 16 if they detect null bytes but this can also fail.

That's insane and has to be fixed. I just tried to open a couple of files WER generated and... no go.

Not only it is unreasonable not to open UTF-16 encoded text files without a BOM since there too many of those files out there, it is completely ridiculous when Microsoft itself generates such files all over the place.

I think we should allow to change the encoding from the editor in all cases even if we think the file is binary.

I agree.

But... Two years and still nothing? ☹️ I don't blame you personally, Benjamin, but I certainly blame Microsoft.

-"The file will not be displayed because is it either binary, very large or an unsupported text encoding."
-"WAT? That's UTF-16!"
-"Sorry, bro. I only support ASCII and EBCDIC."

That's how it sounds.

Being able to open text files is the first requirement from a source code editor, or an advanced text editor, or any text editor...

@bpasero bpasero changed the title Allow to change the encoding for files that seem to be binary Allow to open binary files in the text editor as explicit user gesture Mar 30, 2018
@bpasero bpasero self-assigned this Apr 3, 2018
@bpasero bpasero modified the milestones: May 2018, April 2018 Apr 3, 2018
@bpasero bpasero closed this as completed in 4677099 Apr 3, 2018
@bpasero
Copy link
Member

bpasero commented Apr 3, 2018

There is now a new action to force open a file that we think is binary into the editor. You can then change the encoding accordingly.

image

@vscodebot vscodebot bot locked and limited conversation to collaborators May 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality file-encoding File encoding type issues on-testplan workbench-editors Managing of editor widgets in workbench window
Projects
None yet
Development

No branches or pull requests

7 participants