Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Dump breaks umlauts in data #278

Open
peterhirn opened this issue Mar 30, 2023 · 0 comments
Open

Dump breaks umlauts in data #278

peterhirn opened this issue Mar 30, 2023 · 0 comments

Comments

@peterhirn
Copy link

peterhirn commented Mar 30, 2023

Probably related to #113

CREATE TABLE [dbo].[foo] (
    [id] INT NOT NULL IDENTITY(1,1),
    [value] NVARCHAR(256) NOT NULL,
);

INSERT INTO [dbo].[foo] (value) VALUES (N'Hello Wörld');
mssql-scripter -S localhost -d test -U sa --data-only  > ./backup.sql

The resulting file is utf-8 encoded, but the sql values are broken.

ö is converted to 0xE2 0x94 0x9C 0xE2 0x95 0xA2

USE [test]
GO
SET IDENTITY_INSERT [dbo].[foo] ON 

INSERT [dbo].[foo] ([id], [value]) VALUES (1, N'Hello W├╢rld')
SET IDENTITY_INSERT [dbo].[foo] OFF

Subsequent restores of the backup create garbage values, eg. after the first restore Hello Wörld. If this value is then dumped and restored again, it will start to grow fast. eg. second restore Hello W├╢rld.

Update / Workaround

This issue might be limited to running mssql-scripter in powershell. Replacing the output redirect > with -f avoids the problem.

mssql-scripter -S localhost -d test -U sa --data-only -f ./backup.sql
USE [test]
GO
SET IDENTITY_INSERT [dbo].[foo] ON 

INSERT [dbo].[foo] ([id], [value]) VALUES (1, N'Hello Wörld')
SET IDENTITY_INSERT [dbo].[foo] OFF
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant