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-issue-importer opened this issue Sep 8, 2018 · 4 comments
Closed

Comments

@firebird-issue-importer
Copy link

@firebird-issue-importer firebird-issue-importer commented Sep 8, 2018

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-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 8, 2018

Commented by: jack128 (jack128)

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 9, 2018

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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants