houper888 opened a new issue, #35038:
URL: https://github.com/apache/shardingsphere/issues/35038

   I use Npgsql to connect to ShardingSphere, and the data source is OpenGauss. 
When I read the data, an error will occur if I encounter Chinese characters,but 
English data can be read normally.
   
   error message :
      Unable to translate bytes [E7][90] at index 21 from specified code page 
to Unicode.
     
   
![Image](https://github.com/user-attachments/assets/60387efd-0f3c-434a-90bc-3e48dc43fb0a)
   
   ```
    try
    {
        string connectionString = 
"Host=192.168.31.172;port=3307;Username=ommall;Password=Anterprix123!;Database=goaml_cmbc_gauss;Server
 
       Compatibility Mode=NoTypeLoading;Encoding=UTF-8;";
        using (NpgsqlConnection connection = new 
NpgsqlConnection(connectionString))
        {
            connection.Open();
            string sql1 = "select * from g_group  ";
            using (NpgsqlCommand command1 = new NpgsqlCommand(sql1, connection))
            {
                using (NpgsqlDataReader reader1 = command1.ExecuteReader())
                {
                    while (reader1.Read())
                    {
                        var bytes = reader1.GetString(1);_
                    }
                }
            }
   
        }
   
    }
    catch (Exception ex) {
        throw new Exception(ex.Message);
    }
   ```
   My ShardingSphere configuration:
   
   **Gloab.yaml**
   ```
   mode:
    type: Standalone
    repository:
      type: JDBC
    
   
   authority:
    users:
      - user: root@%
        password: qqq123!
        admin: true
        authenticationMethodName: md5
      - user: sharding
        password: qqq123!
        authenticationMethodName: md5
   
    authenticators:
       md5:
         type: MD5
    privilege:
      type: ALL_PERMITTED
   
   transaction:
    defaultType: XA
    providerType: Atomikos
   
   sqlParser:
    sqlStatementCache:
      initialCapacity: 2000
      maximumSize: 65535
    parseTreeCache:
      initialCapacity: 128
      maximumSize: 1024
   
   logging:
    loggers:
    - loggerName: ShardingSphere-SQL
      additivity: true
      level: INFO
      props:
        enable: false
   
   # sqlTranslator:
   #   type:
   #   useOriginalSQLWhenTranslatingFailed:
   
   sqlFederation:
    sqlFederationEnabled: true
    allQueryUseSQLFederation: false
    executionPlanCache:
      initialCapacity: 2000
      maximumSize: 65535
   
   props:
    system-log-level: INFO
    sql-show: true
    sql-simple: false
    max-connections-size-per-query: 100
    kernel-executor-size: 16  # Infinite by default.
    proxy-frontend-flush-threshold: 128  # The default value is 128.
    load-table-metadata-batch-size: 1000
   
    charset: UTF-8
    allow-multiple-queries: true
    check-table-metadata-enabled: false
   
    proxy-backend-query-fetch-size: 200
    proxy-frontend-executor-size: 0 # Proxy frontend executor size. The default 
value is 0, which means let Netty decide.
    proxy-frontend-database-protocol-type: PostgreSQL 
    proxy-frontend-max-connections: 0 # Less than or equal to 0 means no 
limitation.
    proxy-default-port: 3307 # Proxy default port.
    proxy-netty-backlog: 1024 # Proxy netty backlog.
    cdc-server-port: 33071 # CDC server port
    proxy-frontend-ssl-enabled: false
    proxy-frontend-ssl-cipher: ''
    proxy-frontend-ssl-version: TLSv1.2,TLSv1.3
   ```
   
   **database-sharding.yaml**
   ```
   databaseName: goaml_cmbc_gauss
   dataSources:
    ds_0:
      url: 
jdbc:postgresql://localhost:5432/sharding_db?useUnicode=true&characterEncoding=UTF-8
      username: root
      password: password
      connectionTimeoutMilliseconds: 30000
      idleTimeoutMilliseconds: 60000
      maxLifetimeMilliseconds: 1800000
      maxPoolSize: 50
      minPoolSize: 1
    ds_1:
      url: 
jdbc:postgresql://localhost:5433/sharding_db?useUnicode=true&characterEncoding=UTF-8
      username: root
      password: password
      connectionTimeoutMilliseconds: 30000
      idleTimeoutMilliseconds: 60000
      maxLifetimeMilliseconds: 1800000
      maxPoolSize: 50
      minPoolSize: 1
   
   rules:
   - !SHARDING
    tables:
      table_order:
        actualDataNodes: ds_${0..1}.table_order
      
        databaseStrategy:
           standard:
             shardingColumn: display_id
             shardingAlgorithmName: database_inline
      
        keyGenerateStrategy:
          column: display_id
          keyGeneratorName: snowflake
    
      ev_order:
        actualDataNodes: ds_${0..1}.ev_order
      table_order_item:
        actualDataNodes: ds_${0..1}.table_order_item
      
        databaseStrategy:
           standard:
             shardingColumn: display_id
             shardingAlgorithmName: database_inline
     
        keyGenerateStrategy:
          column: display_id
          keyGeneratorName: snowflake
      ev_cif_head:
        actualDataNodes: ds_${0..1}.ev_cif_head:
   
    defaultDatabaseStrategy:
      standard:
        shardingColumn: display_id
        shardingAlgorithmName: database_inline
    defaultTableStrategy:
      none:
   
   
    shardingAlgorithms:
      database_inline:
        type: INLINE
        props:
          algorithm-expression:  ds_$->{display_id % 2}
      table_snow_flake_inline:
        type: INLINE
        props:
          algorithm-expression: c_cif_test_master{display_id % 2}
    
      id_inline:
        type: INLINE
        props:
          algorithm-expression: ds_$->{id % 2}
   
   
    keyGenerators:
      snowflake:
        type: SNOWFLAKE
        props:
            
             worker-id: 123
   
      uuid:
        type: UUID
   
    auditors:
      sharding_key_required_auditor:
        type: DML_SHARDING_CONDITIONS
        
   - !SINGLE
      tables:
        - "*.*.*"
      defaultDataSource: ds_0
   ```
   
   **But if I directly connect to the OpenGauss database, I can normally obtain 
Chinese data.**
   
   I'd like to ask if there is something wrong with my settings? 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
notifications-unsubscr...@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to