Author Topic: getting slickedit to default to opening all files in utf-8 no BOM mode  (Read 3085 times)

greggman

  • Senior Community Member
  • Posts: 280
  • Hero Points: 14
Is there a way to get slickedit to default to opening call files in UTF-8 no BOM mode

Example, I go into Options->File Options->Load->Encoding and set to UTF-8, no signature

Then I open a terminal (macos) and type

      cat > utf8test.html
      これは日本語です。
      ctrl-d

Now I try to open that file in slickedit. In my case (brief mode) I press Ctrl-E which brings up the Slickedit Smart Open (not the OS File Dialog).  I select `utf8test.html` and I get



I'm a little surprised this isn't the default (I guess Auto Unicode is the default) but in any case it seems to not be working.

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: getting slickedit to default to opening all files in utf-8 no BOM mode
« Reply #1 on: January 03, 2018, 09:17:46 PM »
Is that Japanese?  Can you post the file that doesn't work?  Can you post your help -> about details?

greggman

  • Senior Community Member
  • Posts: 280
  • Hero Points: 14
Re: getting slickedit to default to opening all files in utf-8 no BOM mode
« Reply #2 on: January 04, 2018, 02:47:29 AM »
File attached below, yes it's Japanese in utf-8

Help->About details. You mean this?

Code: [Select]
SlickEdit Pro 2017 (v22.0.1.0)

Serial number: FE10222
Licensed number of users: Single user
License file: /Library/Application Support/SlickEdit/22/slickedit.lic

Build Date: December 17, 2017
Emulation: Brief

OS: macOS
OS Version: 10.13.2
Processor Architecture: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz 64 bit (8 cores)

Memory: 99% Load, 16368MB/16384MB Virtual
Shell Information: /Applications/SlickEditPro2017.app/Contents/MacOS/secsh -i
Screen Size: 1680 x 1050

Project Type: Cpp
Language: .html (HTML)
Encoding: Automatic

Installation Directory: /Applications/SlickEditPro2017.app/Contents/
Configuration Directory: /Users/gregg/Library/Application Support/SlickEdit/22.0.1/
Migrated from: /Users/gregg/Library/Application Support/SlickEdit/22.0.0/
Spill File: /tmp/$slk.gregg.75022

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: getting slickedit to default to opening all files in utf-8 no BOM mode
« Reply #3 on: January 04, 2018, 11:29:48 AM »
I think slick gets it "wrong" because in the file extension settings, html files have a default encoding of "auto html" so slick is probably expecting something like
<meta charset="UTF-8"/>
I suspect slick should be choosing UTF-8 when it can't find a setting for the encoding.

In the file extension manager you can force the encoding for all extensions to be UTF-8 no signature if you want but this is probably not a good idea.  If you set an encoding of "automatic" for all extensions and a default encoding of UTF-8 no signature in "File options -> Load", slick opens your html file as UTF-8 as you want.  I haven't checked what this does with a proper html file that is not UTF-8.

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2899
  • Hero Points: 153
Re: getting slickedit to default to opening all files in utf-8 no BOM mode
« Reply #4 on: January 04, 2018, 04:37:45 PM »
If you use the "classic" open dialog, you can specify the encoding there and it will remember it. 

Also, go to Document>(language) Options, and click on "File Options".  Be sure "Load as Binary" is off.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6875
  • Hero Points: 530
Re: getting slickedit to default to opening all files in utf-8 no BOM mode
« Reply #5 on: January 04, 2018, 11:43:00 PM »
Probably best to change your encoding for the "html" file extension to "Utf-8" or "Auto HTML5" to affect all your html files (Tools>Options>Languages>File Extension Manager). You may also need to follow Dan's instruction but only if changing the encoding for html extension files doesn't fix this for you.

I tested this and it works.

greggman

  • Senior Community Member
  • Posts: 280
  • Hero Points: 14
Re: getting slickedit to default to opening all files in utf-8 no BOM mode
« Reply #6 on: January 04, 2018, 11:55:27 PM »
Thanks guys, followed Graeme's advice and set the encoding under Languages->File Extension Manager for all extensions and that's working for me. I don't think I've encountered a non UTF-8 file since about 2008. Every other editor I use defaults to UTF-8, only slickedit has its defaults set to do something else.

Dan's advice is exactly what I was trying to avoid because that path is what I've been putting up with for years. First open the file, find out the encoding is wrong, close the file, manually reopen in the classic dialog and manually set the encoding. That path is not very fun.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6875
  • Hero Points: 530
Re: getting slickedit to default to opening all files in utf-8 no BOM mode
« Reply #7 on: January 05, 2018, 12:26:02 AM »
I'm looking into changing SlickEdit's default html encoding determination. Might be as simple as changing it to autohtml5.

SlickEdit tries to go by whatever that languages specification is. At least that's the idea. In this case, there are two specifications. The latest spec is HTML5 which definitely defaults to Utf-8.

If you want everything to assume Utf-8, that's pretty reasonable (especially for Mac). Not all source files on Windows are considered Utf-8 for sure. I wish they were.