_UTF8 prefix for string values does not work with WIN1252 charset
-----------------------------------------------------------------

                 Key: DNET-933
                 URL: http://tracker.firebirdsql.org/browse/DNET-933
             Project: .NET Data provider
          Issue Type: Bug
          Components: Entity Framework
    Affects Versions: 7.5.0.0
            Reporter: Daniel Richter
            Assignee: Jiri Cincura


For string values in queries, the generated SQL results in inline values with 
the prefix "_UTF8". E.g,
   dataContext.Articles.Where(a => a.Name=="Mülltüte")
generates SQL such as
   SELECT * FROM "ARTICLE" WHERE "NAME"=_UTF8'Mülltüte'
   
That works as long as the connection charset is set to "UTF8". In case the 
connection string defines a charset such as "WIN1252" the execution throws an 
error "Dynamic SQL Error, SQL error code = -104, Malformed string" (when e.g. 
the value contains an umlaut).
After removing the "_UTF8" prefix everything works fine (both WIN1252 and UTF8 
charset):
   SELECT * FROM "ARTICLE" WHERE "NAME"='Mülltüte'

Because of the following code in SqlGenerator.cs, Visit(DbConstantExpression)
        // constant is always considered Unicode
        isUnicode = true;
The "_UTF8" prefix will always be generated - no matter which charset was used 
to connect. 

In my opinion it is not possible to use string values in queries with charsets 
other than UTF8. The "_UTF8" prefix should only be added in case the database 
connection uses UTF8, too.

Otherwise: Is it safe to connect via UTF8 to a database with WIN1252 as charset 
for columns or are there any side effects? 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       


_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to