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

Calling a stored procedure with Umlauts (äöü) does not store these correctly in the database [DNET453] #446

Closed
firebird-automations opened this issue Aug 20, 2012 · 3 comments

Comments

@firebird-automations
Copy link

Submitted by: Ashwani Mehlem (amehlem)

When calling a stored procedure with a named parameter that contains Umlauts,
these Umlauts get corrupted before the stored procedure is entered.
The same issue does not happen when the parameter is used to issue an update-statement.
This happened no matter what values where used for:
- Charset in the connection string
- Charset in the parameter
- FbDBType in the parameter
- DbType in the parameter
It seems as if the Charset gets ignored when calling a stored procedure that accepts a blob.

Code that produced the error:

        char separator = Convert\.ToChar\(31\);

        string databaseConnectionString = "Database=D:\\\\EON\\\\Datenbank\\\\GS\.fb2";
        databaseConnectionString \+= ";User=SYSDBA";
        databaseConnectionString \+= ";Password=masterkey";
        databaseConnectionString \+= ";CharSet=NONE";
        databaseConnectionString \+= ";ServerType=0";

        FbConnection connection = new FbConnection\(databaseConnectionString\);
        connection\.Open\(\);

        var command = new FbCommand\("EXECUTE PROCEDURE UpdateOrInsertGSObject\('Systemkennzeichen 4', 1, '0324 00BFL', 1, 0, @propNames, @propValues\)", connection\);
        byte\[\] bytesPropertyNames = Encoding\.GetEncoding\(1252\)\.GetBytes\("Name" \+ separator\);
        byte\[\] bytesPropertyValues = Encoding\.GetEncoding\(1252\)\.GetBytes\("Äöü" \+ separator\);
        command\.Parameters\.Add\("@propNames", bytesPropertyNames\);
        FbParameter value = new FbParameter\("@propValues", bytesPropertyValues\);
        value\.Charset = FbCharset\.None;
        value\.FbDbType = FbDbType\.Text;
        value\.DbType = DbType\.String;
        value\.Direction = ParameterDirection\.Input;
        command\.Parameters\.Add\(value\);
        command\.ExecuteNonQuery\(\);
        command\.Dispose\(\);
        connection\.Close\(\);
@firebird-automations
Copy link
Author

Commented by: @cincuranet

How the SP looks like? Why are you using NONE charset and why are you creating byte array from the string? The charset is handled by internals transparently, you don't have to create byte arrays or anything like that.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: In Progress [ 3 ] => Closed [ 6 ]

resolution: Incomplete [ 4 ]

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