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

WIN1251 is invalid character on .Net Core projects [DNET849] #781

Closed
firebird-automations opened this issue Sep 8, 2018 · 4 comments
Closed

Comments

@firebird-automations
Copy link

Submitted by: jack128 (jack128)

Project:

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="6.3.0" />
</ItemGroup>

</Project>

Code:

class Program
{
static void Main(string[] args)
{
Test();
Console.ReadKey();
}

    static void Test\(\)
    \{
        var connectionString = new FbConnectionStringBuilder 
        \{ 
            Charset = "WIN1251",
            Database = "localhost:D:\\\\DataBases\\\\CM\\\\New2\\\\CMBASE \(2\)\.FDB",
            UserID = "SYSDBA",
            Password = "masterkey"                
        \};           
        
        var connection = new FbConnection\(connectionString\.ToString\(\)\);
        try
        \{
            connection\.Open\(\);
            Console\.WriteLine\("Connection is successful"\);
        \}
        catch \(Exception e\)
        \{
            Console\.Write\("ERROR: "\);
            Console\.WriteLine\(e\);                
        \}
        finally
        \{
            connection\.Close\(\);
        \}            
    \}
\}

build project, run \bin\Debug\net461\MultiTargetConsoleApp.exe, output: "Connection is successful" as expected
but when you run core version dotnet .\bin\Debug\netcoreapp2.1\MultiTargetConsoleApp.dll output: ERROR: FirebirdSql.Data.FirebirdClient.FbException (0x80004005): Invalid character set specified

If I set charset to NONE, error is disappear.

@firebird-automations
Copy link
Author

@firebird-automations
Copy link
Author

Commented by: jack128 (jack128)

actually, i think app should call Encoding.RegisterProvider, so issue can be close

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Also https://www.tabsoverspaces.com/233650-using-national-character-sets-with-net-core-and-firebirdclient .

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => Closed [ 6 ]

resolution: Won't Fix [ 2 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants