Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.run with a utf-8 script with unicode strings does wrong conversion #56

Open
etiennellipse opened this issue Apr 16, 2019 · 0 comments
Open

Comments

@etiennellipse
Copy link

Version: 0.6.2
MacOS 10.14.4
Node v10.15.2

I have a SQL script encoded in UTF-8 that contains insert statements with unicode strings that are inserting in a NVARCHAR field. When I run this script, the data inserted in the table is malformed.

Example:

CREATE TABLE homeInstitution
(
    id INT IDENTITY(0,1) NOT NULL PRIMARY KEY,
    institution NVARCHAR(128) NOT NULL,
    deletedDate DATETIME NULL,
);

INSERT [dbo].[homeInstitution] ([institution], [deletedDate]) VALUES (N'Lycée ÀÉÙÇÊÏ', NULL)
  1. Save this into a UTF-8 encoded file
  2. Connect to mssql, run the script: .run myfile.sql
  3. select * from homeInstitution

Result:

mssql> select * from homeInstitution;
id  institution    deletedDate
--  -------------  -----------
0   Lycée ������  null

1 row(s) returned
  • If I convert the file to ISO-8859-1 format, the data is inserted correctly
@etiennellipse etiennellipse changed the title .run with a utf-8 script with unicode strings with N' prefix does wrong conversion .run with a utf-8 script with unicode strings does wrong conversion Apr 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant