dbml icon indicating copy to clipboard operation
dbml copied to clipboard

mssqlConnector producing badly encoded chars

Open giswa opened this issue 8 months ago • 1 comments

Hi guys,

I'm using the connector.fetchSchemaJson(connection, 'mssql'); to get my DB scripted. Works fine except it outputs badly encoded chars.

eg german: f�r instead of für, Integrit�t for Integrität

I can trace the problem coming from the tedicious mssql package, with this p.o.c. :

const sql = require('mssql');
const fs = require("node:fs");

(async () => {
    try {
        // make sure that any items are correctly URL encoded in the connection string
        await sql.connect('...')
        const result = await sql.query`SELECT top 10 * FROM sys.extended_properties`
        fs.writeFileSync('extended-properties.json', JSON.stringify(result , null, 2));
    } catch (err) {
        console.error(err);
    }
})()

output the same encoding problem.

Any idea ?

giswa avatar May 02 '25 08:05 giswa

Hi @giswa ,

I'm Huy Le and thank you for reporting the issue.

I tried to reproduce your issue, but it didn't work.

Can you provide me with your environment in detail?

  • @dbml/connector version
  • Node version.
  • mssql package version.
  • Also, your sql if possible.

Thanks.

huyleminh01 avatar May 08 '25 04:05 huyleminh01