求助 http 编码 utf8,写入文件指定 utf8,生成 utf16le 文件

返回 header

Headers {
   [Object: null prototype] {
     \'content-encoding\': [ \'gzip\' ],
     \'content-type\': [ \'application/json; charset=utf-8\' ],
     date: [ \'Tue, 22 Sep 2020 03:53:46 GMT\' ],
     server: [ \'Caddy\' ],
     \'x-request-id\': [ \'\' ],
     connection: [ \'close\' ],
     \'transfer-encoding\': [ \'chunked\' ] } }

部分返回内容

\"\"\"
鍦板潃鏀惰棌


columns and relationships of \"address\"

\"\"\"
type address {
  \"\"\"鍦板潃琛屾斂鍒掑垎\"\"\"
  address_components(
    \"\"\"JSON select path\"\"\"
    path: String
  ): jsonb

  \"\"\"璇︾粏鍦板潃\"\"\"
  formatted_address: String

  \"\"\"缁忕含搴?\"\"
  geometry: geography
  id: uuid!

文件写入

fs.writeFileSync(output, \'\\uFEFF\' + schema, {
      encoding: \'utf8\',
    })

最后文件是 utf16-le,转成 utf-8 会乱码?

不清楚哪里出问题了

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注