Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Reading Arabic Data from mysql shows junk

Mohammed Ali A. SyedSep 17 2024 — edited Sep 17 2024

Hi,

Using Heterogenous services, odbc, mysql drivers i have configured connection from Oracle DB (oracle DB 21c) to Maria DB (8.0.39-0ubuntu0.22.04.1).

Versions:

Oracle Database : Version 21.3.0.0.0

Oracle Database Gateways: 21.0.0.0.0

Maria DB: (8.0.39-0ubuntu0.22.04.1)

# rpm -qa |grep mysql
mysql-connector-odbc-5.2.5-8.el7.x86_64
mysql-connector-odbc-8.0.28-1.el7.x86_64

Character Sets:

Oracle Characterset: AL32UTF8

Mysql Characterset: utf8mb4

Issue

علي الغامدي is text in Maria DB

its showing as علي الغامدي

Hex dump of (علي الغامدي) it in Mysql

علي الغامدي is D8B9D984D98A20D8A7D984D8BAD8A7D985D8AFD98A

rawtohex('علي الغامدي') of it in Mysql

D8B9D984D98A20D8A7D984D8BAD8A7D985D8AFD98A

select dump(colname,1016) from table@test; in Oracle is

Typ=1 Len=41 CharacterSet=AL32UTF8: c3,98,c2,b9,c3,99,c2,84,c3,99,c2,8a,20,c3,98,c2,a7,c3,99,c2,84,c3,98,c2,ba,c3,98,c2,a7,c3,99,c2,85,c3,98,c2,af,c3,99,c2,8a

1. **D8B9** in UTF-8:

  • The hexadecimal D8B9 corresponds to the Arabic letter **ع** (Unicode U+0639).
  • In UTF-8, U+0639 is encoded as the two-byte sequence **D8 B9**.

2. **C3 98 C2 B9**

The sequence C3 98 C2 B9 consists of two separate parts:

  • C3 98 is the UTF-8 encoding for **Ø** (U+00D8, LATIN CAPITAL LETTER O WITH STROKE).
  • C2 B9 is the UTF-8 encoding for ¹ (U+00B9, SUPERSCRIPT ONE).

It seems that during the conversion, somehow getting two separate characters instead of the original Arabic character.

My initfile is as follows

HS_FDS_CONNECT_INFO=test
# Data source name in odbc.ini
HS_FDS_TRACE_LEVEL=OFF
#HS_FDS_SHAREABLE_NAME=/usr/local/lib/libodbc.so
HS_FDS_SHAREABLE_NAME=/usr/lib64/libodbc.so
#HS_FDS_SHAREABLE_NAME=/u01/app/oracle/product/21.3.0/app/unixODBC-2.3.5/lib/libodbc.so
#HS_FDS_SUPPORT_STATISTICS=FALSE
#HS_LANGUAGE=AMERICAN_AMERICA.UTF8
HS_KEEP_REMOTE_COLUMN_SIZE=LOCAL
HS_NLS_LENGTH_SEMANTICS=CHAR

HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P15

# ODBC env variables
set ODBCINI=/u01/app/oracle/product/21.3.0/etc/odbc.ini

#set LD_LIBRARY_PATH=/usr/lib64

cat /u01/app/oracle/product/21.3.0/etc/odbc.ini

Driver = /usr/lib64/libmyodbc8a.so
Description = Connector/ODBC 5.1 Driver DSN
SERVER =X.X.X.X
PORT = XXXX
USER = A
PASSWORD = B
DATABASE = C
OPTION = 0
TRACE = OFF
CHARSET = utf8mb4

Comments
Post Details
Added on Sep 17 2024
3 comments
83 views