Sublime Forum

Issue when working with the EURO symbol in ST 3.2 Build 3200

#1

Hello All ,

ST default encoding is Ascii so there are cases when a command line working python does not work in SB. I have found no solution for the following issue :

mystring=‘KERING 496,300 € © +0,34%’ -> will cause an Ascii error in ST due to the ‘€’

So i run it by adding:

-- coding: utf-8 --

mystring=‘KERING 496,300 € © +0,34%’

But then the following standard statement causes a syntax error
LastDate = str(f’{datetime.datetime.now():%Y-%m-%d-%H:%M}’)

There seems to be no way out of this catch 22 situation.

I am surely going wrong somewhere… I hope

0 Likes

#2

I think the default encoding for Sublime is utf-8, not ascii. Did you by any change create your own Python build system instead of using the one that’s built in? If so, you may have forgotten to include the line that sets the environment variable that tells Python that it should just assume it’s outputting in UTF-8 and not to try and guess it at runtime (because it will get it wrong).

For example, the built-in build system looks like:

{
	"shell_cmd": "python -u \"$file\"",
	"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
	"selector": "source.python",

	"env": {"PYTHONIOENCODING": "utf-8"},

	"variants":
	[
		{
			"name": "Syntax Check",
			"shell_cmd": "python -m py_compile \"${file}\"",
		}
	]
}

The env tells the interpreter to do it’s IO in utf-8. If you don’t have a line like that in your build system, I’d try that first and see what happens.

0 Likes

#3

Hello OdatNurd…

Thanks VERY MUCH for the feed back . I did not use anything outside of the box except the customization of the ctrl-break key since i have an azert keyboard…

You are right I checked the settings in
packages\default\preferences.sublime.settings

and see:

// Encoding used when saving new files, and files opened with an undefined
// encoding (e.g., plain ascii files). If a file is opened with a specific
// encoding (either detected or given explicitly), this setting will be
// ignored, and the file will be saved with the encoding it was opened
// with.
“default_encoding”: “UTF-8”,

So now even more lost because i have no clue about what is happening with my euro riddle…

Is there anything else i can do ?
I am running ST on windows and the issue appeared only on the recent ST upgrade (I worked fine before:))

Olivier

0 Likes

#4

Hello again OdatNurd (or Terence)

Don’t bother anymore I found the issue-It has nothing to do with ST (which is perfect !!).

In fact I tried to install sqlite3 for node.js on my windows machine and as always this is (still is) tricky.
At one point I installed npm 'windows-build-tools ’ and this caused my python version to default to 2.7 instead of my usual 3.7.2.

Of course this in turn caused the issue in ST.

Sorry for the trouble and all the best
Olivier

1 Like

#5

Glad you got it all sorted out. :smiley:

0 Likes