chakroun yesser
chakroun yesser

Reputation: 1487

Netbeans file cannot be safely opened

I get files from friend who don't use netbeans IDE, when i open file that contain special caracter like 'é','à',... it show me this popup message : this popup message

if i say yes it open the file and changes those caracters to '�' like this or this

Any idea how to open the file safely?

Upvotes: 8

Views: 12639

Answers (3)

Alexandr
Alexandr

Reputation: 1

Found a netbeans solution online that works for MPLAB X. Correction two files, ...\mplab_ide\etc\mplab_ide.conf ...mplab_ide\harness\etc\app.conf

in the line default_options= add an additional option "-J-Dfile.encoding=UTF-8". Example default_options="-J-Dfile.encoding=UTF-8 -J-Dstatistics.connect=false -J-Dcore.properties.disableHttpProxy=true ... default_options="-J-Dfile.encoding=UTF-8 -J-Dcrownking.stream.verbosity=very-quiet ...

Upvotes: 0

Paul Crotty
Paul Crotty

Reputation: 31

I recently encountered a very similar problem (I have some javascript files in Chinese which translated into similar non-human readable text upon re-opening the file in NetBeans).

My OS: Linux Mint (version 17, Cinnamon; Notepad++ not available and gedit did not solve the problem).

Netbeans Version: 8.0.1

However, I was blessed to have found the history feature! I was able to get a former version of my file restored and backed it up immediately.

To access a file's history simply click on the History button found on the left side of the tool bar between the tabs of open files at the top of the IDE and the actual source code. (You can also right click on the file name and selected History -> Show History). Then Double click on a *Timestamp representing a valid version of your file. Just below the table of Timestamps the old 'backup' file and the current 'corrupted' file should appear side-by-side. (You can preview several historical versions of the file until you find one that works best for you; of course, when choosing a file I suggest one which is still usable and has the most current Timestamp associated with it!) ). Right click again on the 'backup' version of your choice -> Revert from History. Click back on the Source button found right next to the History button.

Finally, to change the default encoding, I applied the fix suggested by Sebas and Danny here: How to change file encoding in NetBeans? Please note that the path to the netbeans.conf file is different (at least with version 8.0.1 on my Linux machine). The path on my machine was : ~/netbeans-8.0.1/etc/netbeans.conf.

This saved the day for me and I hope it helps someone else out there! Bonne chance.

Upvotes: 3

Tarik
Tarik

Reputation: 11209

The letters you are mentioning seem to be French. You need to open the file, specifying the original encoding, then save the file as UTF-8

Upvotes: 4

Related Questions