
| Key: |
BOO-708
|
| Type: |
Improvement
|
| Status: |
Open
|
| Priority: |
Minor
|
| Assignee: |
Unassigned
|
| Reporter: |
Snaury
|
| Votes: |
0
|
| Watchers: |
1
|
|
If you were logged in you would be able to see more operations.
|
|
|
Boo
Created: 03/Apr/06 04:14 AM
Updated: 26/May/06 02:15 AM
|
|
| Component/s: |
Parser,
Compiler
|
| Affects Version/s: |
0.7.6
|
| Fix Version/s: |
None
|
|
Currently Boo always opens source files in utf-8 encoding, which is not always a good thing (at least for me). I'd like to propose a patch that allows a kind of PEP-263* style encoding specifications in source files. Unfortunately, I couldn't do it the way I wanted due to a strange bug in MS.NET, where StreamReader.CurrentEncoding is always equal to an encoding passed as parameter, even if there was BOM detected and it in fact uses UTF8 or Unicode encoding. The only drawback is that every file gets opened twice (sadly no way I know to rewind StreamReader, and I don't know whether loading a whole file into memory to stop this is a good idea). Also, probably it would be good (or maybe not) to throw an exception if encoding, specified in source file, could not be found. Also, I didn't want to break compatibility, so if encoding is not specified, it defaults to UTF-8 as it was before (however, just in case, the first open is done using ASCII encoding (if there's not BOM), don't know if that's good or bad).
|
|
Description
|
Currently Boo always opens source files in utf-8 encoding, which is not always a good thing (at least for me). I'd like to propose a patch that allows a kind of PEP-263* style encoding specifications in source files. Unfortunately, I couldn't do it the way I wanted due to a strange bug in MS.NET, where StreamReader.CurrentEncoding is always equal to an encoding passed as parameter, even if there was BOM detected and it in fact uses UTF8 or Unicode encoding. The only drawback is that every file gets opened twice (sadly no way I know to rewind StreamReader, and I don't know whether loading a whole file into memory to stop this is a good idea). Also, probably it would be good (or maybe not) to throw an exception if encoding, specified in source file, could not be found. Also, I didn't want to break compatibility, so if encoding is not specified, it defaults to UTF-8 as it was before (however, just in case, the first open is done using ASCII encoding (if there's not BOM), don't know if that's good or bad).
|
Show » |
|