This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 181102

Summary: Encoding exception in setup.py
Product: python Reporter: Neology
Component: OptionsAssignee: vincentvdl
Status: RESOLVED FIXED    
Severity: normal CC: Jenselme, ralphbenjamin
Priority: P4    
Version: 6.x   
Hardware: Macintosh (x86)   
OS: Mac OS X   
See Also: https://netbeans.org/bugzilla/show_bug.cgi?id=257461
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 257461    
Attachments: Test patch 1 (python.editor)

Description Neology 2010-02-23 13:55:42 UTC
Problem with the encoding : __date__ in setup.py (hidden file) can contain accents in french and so create an encoding exception. For this I need to change setup.py...
Comment 1 Lou Dasaro 2015-09-03 05:06:37 UTC
I believe it's valid, but should be downgraded to P2, and add keyword: 'I18N'.
Comments?
Comment 2 Lou Dasaro 2015-09-06 04:35:54 UTC
reassigned to Julien for review...
Comment 3 vincentvdl 2015-09-06 04:45:40 UTC
As I said on the forum, I am on holiday until the end of September and don't have access to a machine capable enough for NB development.

However here's my analysis: setup.py is an ordinary Python script. If a Python 2 script file contains non-ASCII characters it needs a "#encoding: XXXX" header.

So in my view, what should be done is to add the project encoding at the top in the Freemarker template. I have a patch ready that does this, but did not have a chance to test it thoroughly yet, so have not posted it yet.
Comment 4 Lou Dasaro 2015-09-07 18:12:42 UTC
My mistake. Marked as STARTED and reassigned back to Vincent, who will implement the fix when he returns from holiday. 8.1_DEFERRED until then...
Comment 5 Jenselme 2015-09-12 19:46:11 UTC
Just experienced a problem, I don't know if this is related but it looks like it:

If there is a non ascii character in setup(name='Blabla ï blabla'), nbpython fails to open the project.
Comment 6 vincentvdl 2015-10-06 21:38:08 UTC
Created attachment 156570 [details]
Test patch 1 (python.editor)

This adds "#encoding: <ENCODING>" to the remaining FreeMarker templates.

Hopefully this will fix this issue.
Comment 7 Lou Dasaro 2016-01-18 00:41:30 UTC
The patch works, but it always defaults to the O.S. default encoding e.g. on a Windows box it will insert "#encoding: windows-1252".

It was previously agreed that ALL projects will be created with "#encoding: utf-8"
The user can change it if they want...

Vincent, can you make this change and Push it?
Comment 8 Jenselme 2016-10-11 16:04:07 UTC
changeset:   18435:b36f70414d5e
user:        Julien Enselme <jenselme@netbeans.org>
date:        Sun Sep 25 16:46:29 2016 +0200
summary:     #181102 Set encoding in templates