vscode the file is not displayed in the editor because it is either binary or uses an unsupported text encoding - visual-studio-code

I am trying to work by importing the photo2cartoon project from github into my vscode.
https://github.com/kairess/photo2cartoon
But some files are not read in vscode.(model_mobilefacenet,photo2cartoon_weights.pt)
When I try to open it I get the message (the file is not displayed in the editor because it is either binary or uses an unsupported text encoding)
if i click (open anyway)
and my vscode terminal say
but the files are in the same directory
how to fix this problem

Related

VIsual Studio Code Plain Text Files

I have been searching for over 30 minutes but can't find the solution. On my Windows installation of VSCode when I create a new file (default to Plain Text as expected) and I go to save, it defaults to saving with a .txt extension. On my Mac though it defaults to All Files. I have searched through settings and I don't recall changing anything on my Windows machine but I WANT to save new files that are Plain Text with .txt by default on Mac. What am I missing?

How to let VS Code open file using the default program of the operating system?

I am using the latest VS Code to write python Qt code (under Ubuntu 20.04). One obstacle is that VS code does not recognize known file types such as .ui files, and opens it as raw text or xml file.
By comparison, other editors such as eclipse opens the .ui file with its OS default program -- Qt Designer. With VS Code, I had to open a file manager and then find and double-click the file to open it the right way (the same as opening the file using xdg-open in terminal), which is quite inefficient.
Does anyone know of a way to configure VS code to open a known file directly using its OS default program?
There are two extensions that I know of that tackle this problem (no affiliation):
Open in External App
... with this extension, you can do it more simply. Just right click to the file, and select Open in External App, that file would be opened by system default application. You can also use this way to open .psd files with photoshop, .html files with browser, and so on...
The configuration implies that you need to manually set which app to use for which extension, so it doesn't simply use the default configured in your OS (at least not in my brief test).
Open
Opens files using the OS's default program for the file type
This does what it says out of the box, but the keyboard shortcut seems to fail. The command can only be triggered via the right-click menu of the file in the vscode file browser.

How to prevent vscode as default program to run html file?

When I double click a html file, it will be automatically opened in vscode. I set Firefox as default program and it works fine, but every time after I reboot, Visual Stadio Code - URL Handler still be the default program to open a html file.
I use linux mint 18.3, it only happens after vscode upgrade to 1.28
Right click on the file in the chosen format and choose Open With... -> Other Application or Open With Other Application.
Don't forget to check the Remember this application for "..." files checkbox to apply your selection for all files of the same format.
As discussed here

How to open a binary file (e.g. Excel) in Visual Studio Code with its default application

I use Visual Studio Code to work on projects that not only include program code, but also data files, e.g. in Excel format.
VSCode cannot edit such files, as they are binary. Attempting to do so shows a warning, and if you persist, the file is shown (as gibberish).
I've also tried to pass the file to the (CMD) terminal (right click, 'Open in Terminal'). In a regular CMD window that would invoke the default application, but that does not work in VSCode.
Is there a simple way that I can use from VSCode to open such files using the default applications?
The extension sandcastle.vscode-open does this. Install it, and you can open any file with its default application by right clicking on the filename in the explorer menu.
In v1.66 you can set a default editor for binary files and avoid the warning (see release notes: binary file):
Default binary editor
A new setting, workbench.editor.defaultBinaryEditor, lets you
circumvent the binary file warning and automatically open the editor
type of your choosing when a binary file is detected. You can select
the default binary editor from a dropdown in the Settings editor or
via IntelliSense in settings.json.
TBH, I am still investigating whether you can set this to some external application like Excel?

VSCode is appending unsupported text encoding on file save

Not sure what's up with VSCode after updating to Version 1.10.2 VSCode is appending weird characters automatically after saving the file.
If I try to open the file with VSCode I get the following error.
The file will not be displayed in the editor because it is either binary, very large or uses an unsupported text encoding.
This only happens sometimes, not on every single save to disk action.
I'm using a SAMBA share, not sure if that has something to do with it.
I'm on MAC 10.12.3
** Update 3/16/17 **
Here is a gif of how it's happening.