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

Dump breaks umlauts in data #278

Open
@peterhirn

Description

@peterhirn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions