Oracle DBA in KSA

June 10, 2008

How to Show Arabic Characters in Your Client App

Filed under: Oracle — ksadba @ 1:37 pm
Tags: ,

One of the most common questions I face is how do I properly show Arabic characters in a client application.

Client applications are tools such as Toad, SQL Navigator, SQLPLUS or any other application that would connect to a database via an Oracle client.

To view Arabic in such tools, you have to achieve 3 requirements:

1) The database character-set has to be one of the following: AR8MSWIN1256, AR8ISO8859P6 or UTF-8

2) On your MS Windows client side, you need to set your nls_lang parameter to language_territory.AR8MSWIN1256.

3) In your client application, select a font that supports Arabic characters.

But how do I diagnose on which layer the problem is:

For item 1, to find out your database character-set execute:

select * from v$nls_parameters where parameter = ‘NLS_CHARACTERSET’;

Simple enough

For item 2 & 3 use dump function:

Dump function shows internal representation of a string. It is extremely useful in debugging character-set conversion issues.

SQL> select dump(‘كيف حالك‘,1016) from dual;

DUMP(‘كيف حالك‘,1016)

——————————————–

Typ=96 Len=8 CharacterSet=AR8ISO8859P6: e3,ea,e1,20,cd,c7,e4,e3

SQL>

Or you can execute:

Select dump(your_arabic_col, 1016) from your_arabic_table;

If dump function returns 3f (question mark), then your NLS_LANG is not set correctly.

If dump function returns proper representation and still you can’t see Arabic, then you are using a font that doesn’t support Arabic.

But again, how do I know which font to use?

I use charmap utility (start -> run -> type charmap -> enter)

This utility shows each font and its representation. Look for fonts that match AR8MSWIN1256 code page

Hazem Ameen
Senior Oracle DBA

Blog at WordPress.com.