Home Download Buy Blog Forum Support

Dev Build 2144

Dev Build 2144

Postby jps on Fri Nov 25, 2011 12:38 am

Dev Build 2144 is out now, with a few miscellaneous changes.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: Dev Build 2144

Postby bizoo on Fri Nov 25, 2011 8:19 am

Code: Select all
API: Added view.encoding() and view.set_encoding()
API: Added view.line_endings() and view.set_line_endings()

yippee !!!
bizoo
 
Posts: 888
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Dev Build 2144

Postby wuub on Fri Nov 25, 2011 11:48 am

API: Added (...) view.set_encoding()


What are the semantics of .set_encoding()?

1) I've got a file encoded using cp1250 with accented characters,
2) I open this file in Sublime, unfortunately it's able to interpret file content as 'utf-8' string, so the fallback encoding is not used:
Code: Select all
>>> view.encoding()
u'UTF-8'

3) Then I call:
Code: Select all
>>> view.set_encoding(u'Central European (Windows 1250)')
>>> view.encoding()
u'Central European (Windows 1250)'

4) However, it seems like Sublime did not reinterpret the file content (bytes) using new encoding, but simply stored new encoding to be used when saving.

Now that I think about it, this behaviour is reasonable. However I would like to be able somehow handle encoding specifying comments http://www.python.org/dev/peps/pep-0263/.

What do you think jps?
SublimeREPL via Package Control & SublimePTY dev/pre-alpha. Donations are appreciated, but not required :) Twitter: @wuub
wuub
 
Posts: 218
Joined: Wed Aug 10, 2011 8:16 am
Location: Poland

Re: Dev Build 2144

Postby oriceon on Fri Nov 25, 2011 1:17 pm

Hy Jon. There is a problem on showing * on tab that has modified content. (* is missing)
oriceon
 
Posts: 56
Joined: Tue Jun 14, 2011 6:06 am

Re: Dev Build 2144

Postby bizoo on Fri Nov 25, 2011 1:34 pm

oriceon wrote:Hy Jon. There is a problem on showing * on tab that has modified content. (* is missing)

It doesn't work yet with Soda Theme (need update).
But it work for me with default theme (the cross is replaced with a big dot).

startup, version: 2144 windows x64 channel: dev
bizoo
 
Posts: 888
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Dev Build 2144

Postby jps on Fri Nov 25, 2011 1:47 pm

wuub wrote:What are the semantics of .set_encoding()?

It just sets the encoding that will be used when saving next. If you want to reopen the current file with a different encoding, you can use the reopen command - see Default/Main.sublime-menu for an example.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: Dev Build 2144

Postby funkjedi on Fri Nov 25, 2011 4:59 pm

bizoo wrote:
oriceon wrote:Hy Jon. There is a problem on showing * on tab that has modified content. (* is missing)

It doesn't work yet with Soda Theme (need update).
But it work for me with default theme (the cross is replaced with a big dot).

startup, version: 2144 windows x64 channel: dev


To get the indicators working in Soda again you just need to add the following to your Global settings.

Code: Select all
"highlight_modified_tabs": true
funkjedi
 
Posts: 3
Joined: Tue Sep 20, 2011 6:55 pm

Re: Dev Build 2144

Postby oriceon on Sat Nov 26, 2011 10:05 am

ok, thanks
oriceon
 
Posts: 56
Joined: Tue Jun 14, 2011 6:06 am

Re: Dev Build 2144

Postby Mylith on Mon Nov 28, 2011 8:11 am

bizoo wrote:
Code: Select all
API: Added view.encoding() and view.set_encoding()
API: Added view.line_endings() and view.set_line_endings()

yippee !!!


:mrgreen: Thank You Jps!
Mylith
 
Posts: 30
Joined: Mon Oct 17, 2011 12:58 pm

Re: Dev Build 2144

Postby bizoo on Mon Nov 28, 2011 8:20 am

Code: Select all
API: Added view.encoding() and view.set_encoding()
API: Added view.line_endings() and view.set_line_endings()

What's the list of encodings accepted by set_encoding() ?
I try to get an UTF-8 with BOM but didn't find how to spell it...

And is there any plan to have default encoding by syntax ?
Actually, I use different encoding for different language:
-Delphi and PL/SQL files -> cp1252
-Python -> utf-8 BOM
-Almost anything else -> utf-8

Actually new files are 'Undefined' and get an encoding when saved.
What I like is that the encoding used when the file is saved come from a settings in the Base File.sublime-settings (or the syntax specific one).
A warning message before saving if the encoding didn't take care of some of the char in the buffer would be nice.

I'm pretty sure it's easy to make a plugin that trap the on_pre_save event to do that work, but I just wonder if something is planned before doing it.
bizoo
 
Posts: 888
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 18 guests