File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55***
66
7- ### [ v3.5.3 ]
7+ ### [ v3.5.4 ]
88
99** Fixed** :
1010 - Duplicated include path items: ` .eide/deps ` in project.
1111 - Can not parse old version ` JLinkDevices.xml ` .
12+ - Enum serialport failed when use ` 65001 ` code-page in windows os.
1213
1314** Optimized** :
1415 - Optimize cpptools config provider for ` gcc ` family compilers.
Original file line number Diff line number Diff line change 3232 "homepage" : " https://github.com/github0null/eide/blob/master/README.md" ,
3333 "license" : " MIT" ,
3434 "description" : " A mcu development environment for 8051/AVR/STM8/Cortex-M/RISC-V" ,
35- "version" : " 3.5.3 " ,
35+ "version" : " 3.5.4 " ,
3636 "preview" : false ,
3737 "engines" : {
3838 "vscode" : " ^1.63.0"
6060 "readme" : " https://github.com/github0null/eide/blob/master/README.md" ,
6161 "bugs" : {
6262 "url" : " https://github.com/github0null/eide/issues" ,
63- "email" : " 2584456014@qq.com "
63+ "email" : " me@github0null.io "
6464 },
6565 "repository" : {
6666 "url" : " https://github.com/github0null/eide.git" ,
Original file line number Diff line number Diff line change @@ -38,6 +38,26 @@ export enum CodeType {
3838
3939export class CodeConverter {
4040
41+ static trimUtf8BomHeader ( str : string | Buffer ) : string {
42+
43+ if ( str instanceof Buffer ) {
44+ if ( str [ 0 ] == 0xef &&
45+ str [ 1 ] == 0xbb &&
46+ str [ 2 ] == 0xbf ) {
47+ str = str . subarray ( 3 ) ;
48+ }
49+ return str . toString ( ) ;
50+ }
51+
52+ if ( str . charCodeAt ( 0 ) == 0xef &&
53+ str . charCodeAt ( 1 ) == 0xbb &&
54+ str . charCodeAt ( 2 ) == 0xbf ) {
55+ return str . substr ( 3 ) ;
56+ }
57+
58+ return str ;
59+ }
60+
4161 private getCodeType ( bomHead : Buffer ) : CodeType {
4262
4363 let codeType : CodeType ;
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ import { SettingManager } from "./SettingManager";
4141import * as utility from './utility'
4242import { CmdLineHandler } from "./CmdLineHandler" ;
4343import * as yaml from 'yaml' ;
44+ import { CodeConverter } from "./CodeConverter" ;
4445
4546let resManager : ResManager | undefined ;
4647
@@ -165,8 +166,8 @@ export class ResManager extends events.EventEmitter {
165166 enumSerialPort ( ) : string [ ] {
166167 try {
167168 const cmd = `${ this . getMonoName ( ) } "${ this . getSerialPortExe ( ) . path } "` ;
168- const data = ChildProcess . execSync ( cmd , { env : process . env } ) . toString ( ) ;
169- const portList : string [ ] = JSON . parse ( data ) ;
169+ const data = ChildProcess . execSync ( cmd , { env : process . env } ) ;
170+ const portList : string [ ] = JSON . parse ( CodeConverter . trimUtf8BomHeader ( data ) ) ;
170171 if ( ! Array . isArray ( portList ) ) { throw Error ( "get current port list error !" ) ; }
171172 return portList ;
172173 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments