Author Topic: Change character encoding after a file has been opened  (Read 4136 times)

mikael.lyngvig

  • Community Member
  • Posts: 17
  • Hero Points: 0
Re: Change character encoding after a file has been opened
« Reply #15 on: February 13, 2016, 10:36:48 pm »
I resorted to uninstalling SlickEdit, erasing the SlickEdit files in Documents, and re-apply the latest hotfix.

Still no change...  UTF-8 Files without a BOM are garbled.

The only change that came of reinstalling SlickEdit is that encoding "auto unicode" was set to "auto unicode2" without me doing anything.  So I guess the old value was imported from an ancient configuration and never upgraded to the new unicode2 method.

I think I should stop spamming this forum with what appears to be a support issue; SlickEdit UTF-8 with no BOM works for you and so it should for me.  The mere fact that it works for you makes me a very happy person because I've for years thought that SlickEdit couldn't figure out how to handle BOM-less UTF-8 files and instead it turns out that it is some bizarre support issue I'm facing.

Thanks for your help so far!

Graeme

  • Senior Community Member
  • Posts: 2339
  • Hero Points: 307
Re: Change character encoding after a file has been opened
« Reply #16 on: February 13, 2016, 11:19:57 pm »
Try searching on google for pÃ¥  - a few of the results show på  - maybe that gives a clue as to what slickedit is doing.  What font are you using?

If I turn on "line hex" in the view menu I get the incorrect version that you're getting.

mikael.lyngvig

  • Community Member
  • Posts: 17
  • Hero Points: 0
Re: Change character encoding after a file has been opened
« Reply #17 on: February 13, 2016, 11:22:53 pm »
I'm using Default Unicode font as I just reinstalled everything.

I've filed a support request on this issue and hope that the support crew can help me (they usually can).

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4796
  • Hero Points: 388
Re: Change character encoding after a file has been opened
« Reply #18 on: February 14, 2016, 12:24:26 am »
There's a bug in the load options encoding list. It's supposed to list UTF8, no signature. There is a workaround.

Go ahead and choose UTF8 for File>load options>encoding. Now use Macro>Set macro variable... and change +utf8s in the variable def_load_options to +futf8. The only downside to doing this is the GUI load options will be lost and can't display this setting.

mikael.lyngvig

  • Community Member
  • Posts: 17
  • Hero Points: 0
Re: Change character encoding after a file has been opened
« Reply #19 on: February 14, 2016, 01:12:18 am »
My def_load_options value is (even though I've changed the encoding to UTF-8 in File>Load Options>Encoding):

    +L -LF +LE -S -E +U:32000 -N +BP

If I add "+FUTF8" to this line, exit the editor, and open the document under a new name, it still doesn't work.  Whether or not I use "+new -sc TempDir" on the SlickEdit command line.  The manually added "+FUTF8" value does appear if I inspect def_load_options again.

The only things that work are if I use File>Reload with Encoding>UTF-8 or manually add a BOM.  Then the text displays as it should.

Argh! :-)  I really don't get this...   We're talking about a problem that persists across operating systems, editor versions, and configurations.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4796
  • Hero Points: 388
Re: Change character encoding after a file has been opened
« Reply #20 on: February 14, 2016, 01:35:56 am »
I don't know if the +futf8 must be lower case. Try lower case.
« Last Edit: February 14, 2016, 01:44:38 am by Clark »

mikael.lyngvig

  • Community Member
  • Posts: 17
  • Hero Points: 0
Re: Change character encoding after a file has been opened
« Reply #21 on: February 14, 2016, 01:37:35 am »
Actually, I tried both.  The online help lists it in uppercase, so I ended up using that :-)

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4796
  • Hero Points: 388
Re: Change character encoding after a file has been opened
« Reply #22 on: February 14, 2016, 01:45:02 am »

i have goofed a bit here though. It turns out this work around is only needs when creating new files. Choosing Utf-8 in File>load options>encoding should recognize existing Utf-8 files with or without a signature.

mikael.lyngvig

  • Community Member
  • Posts: 17
  • Hero Points: 0
Re: Change character encoding after a file has been opened
« Reply #23 on: February 14, 2016, 01:58:52 am »
Yes, but it doesn't in my end, unfortunately.  I am grateful for all your help, but so far it hasn't changed anything.

I have absolutely no idea of what's going on here.  I have submitted a support case - do you want me to continue in this thread or to work with Support to resolve the issue?

I rename the file every time, before I open it, to a new unique name so as to not trigger SlickEdit's built-in memory of file encodings.  I have tried both with and without customized settings, even a clean install.  Nothing works.  And it hasn't for years, which is why I have been looking for another option recently because it is getting to be really annoying that I can't get SlickEdit to work for me.

Obviously, I'd prefer to get SlickEdit to work but I am ready to switch to another editor, if this issue cannot be resolved.  I work almost full-time in UTF-8 encoded PHP files containing Danish national characters so this is a major hassle for me.  Especially because the UTF-8 BOM breaks some web clients and makes the the XHTML/1.0 validator fail (the whole point of XHTML/1.0 Strict is that it can be validated sensibly).

Also, when you switch a lot between ASCII and UTF-8 files, it is a tedious hassle to have to use File>Save As to determine the encoding.  This should be shown prominently on the status line or in the buffer list (I use the BRIEF emulation).  I have suggested this to support long ago but nothing has happened.

Graeme reported this:

    "If I turn on "line hex" in the view menu I get the incorrect version that you're getting."

So there must be some issue somewhere in there, which I am running into all the time.

A final note: I never use SlickEdit workspaces, I always open and close my files on the fly from a console window.
« Last Edit: February 14, 2016, 02:00:52 am by mikael.lyngvig »

mikael.lyngvig

  • Community Member
  • Posts: 17
  • Hero Points: 0
Re: Change character encoding after a file has been opened
« Reply #24 on: February 14, 2016, 02:08:35 am »
i have goofed a bit here though. It turns out this work around is only needs when creating new files. Choosing Utf-8 in File>load options>encoding should recognize existing Utf-8 files with or without a signature.

I just tried this:

    vs.exe +FUTF8 index708.html

And it WORKED.  I suppose that amounts to manually specifying the encoding.  I'll change my DOSKEY alias for the time being to explicitly specify the +FUTF8 option and hopefully we can resolve this sometime.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4796
  • Hero Points: 388
Re: Change character encoding after a file has been opened
« Reply #25 on: February 14, 2016, 02:22:17 am »
I didn't read into the fact that you're working .html files. Now that I think about it, the solution I gave you shouldn't work for .html files because the default extension specific encoding is "Auto HTML" which overrides the global encoding setting. Go to  Tools>Options>Languages>File Extension Manager and select the "html" extension. Change the encoding from "Auto HTML" to "Utf-8".

I was about to give up and have you use support (their definitely better than I am due to there customer specific experience).

mikael.lyngvig

  • Community Member
  • Posts: 17
  • Hero Points: 0
Re: Change character encoding after a file has been opened
« Reply #26 on: February 14, 2016, 02:40:28 am »
You have solved a big issue for me, thanks!  Even though I only used an HTML file because it illustrated my issue.  I don't regularly edit HTML files so I'll leave the HTML setting as it is, but you definitely helped me get SlickEdit to work for me. 

In combination with the now default +FUTF8 option (in my DOSKEY macro) in my end, I suspect we're getting to the point that it actually works for all file types: I often edit UTF-8 encoded file types that are unknown to SlickEdit and they also appear to work now (without a BOM).  As far as I know, I should never run into any issues forcing the encoding to UTF-8 as I only use UTF-8 and ASCII encoded files.

Perhaps you can pull some strings and get the encoding to be displayed somewhere on the status line?  Just kidding, but it would be nice :-)

Mike

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 100
  • Hero Points: 20
Re: Change character encoding after a file has been opened
« Reply #27 on: December 04, 2018, 02:32:37 pm »
I noticed this older post and wanted to note that SlickEdit does now show the encoding in the status bar, and clicking that item opens the "Save As" dialog so that you can change the encoding.
Thanks for the suggestion!
« Last Edit: December 04, 2018, 02:34:17 pm by Mike »