question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Oracle.EntityFrameworkCore US7ASCII Chinese query garbled code

See original GitHub issue

Oracle.EntityFrameworkCore5.21.1,Database encoding format is ‘SIMPLIFIED CHINESE_CHINA.US7ASCII’,The Chinese data queried in .net5 is garbled

services.AddDbContext<FinanceContext>(op => { op.UseOracle(Configuration.GetConnectionString("Finance") , b => b.UseOracleSQLCompatibility("11") ); });

I put the local environment variable 'NLS_ LANG ‘is changed to the same. The query with’ PL / SQL 'is normal, but the Chinese data in. Net5 is garbled

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:29 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
2881099commented, Nov 8, 2022

@GaoXiong666 freesql Can you solve the problem of garbled code? Are there any examples for reference? 3Q

To solve this problem, you can try the OLEDB method:

dotnet add package FreeSql.Provider.OracleOledb

public class DB
{
    static Lazy<IFreeSql> oracleLazy = new Lazy<IFreeSql>(() => new FreeSql.FreeSqlBuilder()
        .UseConnectionString(FreeSql.DataType.Oracle, "Provider=OraOLEDB.Oracle;user id=9user;password=123456;data source=//127.0.0.1:1521/XE;Pooling=true;Max Pool Size=2")
        .UseNameConvert(NameConvertType.ToUpper)
        .UseNoneCommandParameter(true)
        .UseMonitorCommand(cmd => Console.WriteLine(cmd.CommandText))
        .Build());
    public static IFreeSql oracle => oracleLazy.Value;
}

var list = DB.oracle.Select<T>().Where(a => a.Id > 100).ToList();

DB.oracle.Insert(new T { ... }).ExecuteAffrows();

DB.oracle.Update<T>()
    .Set(a => a.Name, "china")
    .Set(a => a.Time, DateTime.UtcNow)
    .Where(a => a.Id == 100)
    .ExecuteAffrows();

https://github.com/dotnetcore/FreeSql/wiki

0reactions
alexkehcommented, Nov 14, 2022

There won’t be a fix until there’s a clear resolution on what the course of action should be. This is not a bug. It’s more like an enhancement request. However, the ER would be to emulate other providers’ behavior, which itself is not officially supported.

If you’re looking for an ODP.NET fix, I would recommend opening a service request with Oracle Support. Explain the business case, the technical details and constraints, and the urgency/priority. In that process, we’ll see if there’s any supportable workarounds through some combination of Oracle and customer app changes. If not, there will at least be a better understanding what ODP.NET product changes would have to occur.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connecting to Oracle database with Chinese garbled code
Solved: Dear~~ The Chinese of the data we check in PLSQL is normal, but the Chinese on Power Query is garbled. Thanks for...
Read more >
ORAOLEDB US7ASCII character set database drive ...
US7ASCII The client's character set:SIMPLIFIED CHINESE_CHINA. ... character set database drive connections, Chinese garbled, how to solve?
Read more >
Connecting to Oracle database with Chinese garbled code
Connecting to Oracle database with Chinese garbled code ... The Chinese of the data we check in PLSQL is normal, but the Chinese...
Read more >
Storing Chinese Characters - Ask TOM
Tom, We have a new requirement where we need to store Chinese Characters in the database, diplay it and print it.
Read more >
OdbcConnection returning Chinese Characters as "?"
I have an Oracle database that stores some data values in Simplified Chinese. I have created an ASP.net MVC C# webpage that is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found