Skip to Main Content

Database Software

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.

Oracle 11g: Character Set / Language Problem

Ahmed HaroonDec 2 2016 — edited Dec 9 2016

hi all,

create a Function to get values in xmltype ( thanks to ) through an another Function which convert these values in normal format ( thanks to @"odie_63" ) but due to some data in Urdu Language it not showing those column data as it should be. the first function getting data through a Web Service and data is in utf-8 character set.

link for above mentioned topic: How to access API through Web Service in Oracle 11gR2

SELECT *

from NLS_DATABASE_PARAMETERS

WHERE parameter IN ( 'NLS_LANGUAGE', 'NLS_TERRITORY', 'NLS_CHARACTERSET');

PARAMETER                      VALUE

------------------------------ --------------

NLS_LANGUAGE                   AMERICAN

NLS_TERRITORY                  AMERICA

NLS_CHARACTERSET               AL32UTF8

getting data as below, columns which shows opposite question marks (¿¿ ¿¿ ) contain data in Urdu language, what I have to do to have column data ?

CLIENT_CNIC

--------------------------------------------------

CLIENT_NAME

----------------------------------------------------------------------------------------------------

FATHER_HUSBAND_NAME

----------------------------------------------------------------------------------------------------

PRESENT_ADDRESS

----------------------------------------------------------------------------------------------------

PERMANANT_ADDRESS

----------------------------------------------------------------------------------------------------

DATE_OF_BIRTH                                      GENDER

-------------------------------------------------- -------------------------------------------------

EXPIRY_DATE

--------------------------------------------------

4240146

¿¿¿¿¿ ¿¿¿¿ ¿¿¿

¿¿¿¿ ¿¿¿¿ ¿¿¿

¿¿¿¿¿¿ ¿¿¿¿¿¿444/3¿¿¿ ¿¿¿¿¿ ¿¿¿¿¿¿4¿¿¿ ¿¿¿¿¿¿¿  11-1/2¿¿¿¿¿¿n¿¿¿ ¿¿¿¿¿¿ ¿¿¿¿¿¿ ¿¿¿¿¿ ¿¿¿¿¿¿¿¿ ¿¿¿¿¿¿¿

¿ ¿¿¿¿¿¿

¿¿¿¿¿¿ ¿¿¿¿¿¿444/3¿¿¿ ¿¿¿¿¿ ¿¿¿¿¿¿4¿¿¿ ¿¿¿¿¿¿¿  11-1/2¿¿¿¿¿¿n¿¿¿ ¿¿¿¿¿¿ ¿¿¿¿¿¿ ¿¿¿¿¿ ¿¿¿¿¿¿¿¿ ¿¿¿¿¿¿¿

¿ ¿¿¿¿¿¿

1986-08-15                                         male

2016-10-31

please help to solve this issue.

regards

Comments

66232
Hi,
attached two functions one for dumping the other for loading ...

public class Test {
private File fHandle = null;
private static String PATH = null ;
private BLOB bHandle = null;
private String fileName = null ;

protected void dumpBlobToFile() throws SQLException
{

FileOutputStream outstream = null;
InputStream instream = null;

try {
getFileHandle(); // Gets a new file handle.
if (bHandle != null)
instream = bHandle.getBinaryStream(); // Get the blob input stream
else
return ;

if (outstream == null)
outstream = new FileOutputStream(fHandle); // Get the file output stream.


// Read the input stream and write the output stream by chunks.
byte[] chunk = new byte[bHandle.getChunkSize()];
int i = -1;

while ((i = instream.read(chunk)) != -1) {
outstream.write(chunk, 0, i);
}
outstream.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {

// Close the input and output stream.
if (instream != null) {
instream.close();
instream = null ;
}

if (outstream != null) {
outstream.close();
outstream = null ;
}

} catch (IOException e) {
e.printStackTrace();
}
}
}
protected void dumpFileToBlob() throws SQLException
{

FileInputStream instream = null;
OutputStream outstream = null;

try {
getFileHandle(); // Gets a new file handle.

if (bHandle != null) // Get the clob output stream
outstream = bHandle.getBinaryOutputStream();
else
return ;

if (instream == null)
instream = new FileInputStream(fHandle); // Get the file input stream.


// Read the input stream and write the output stream by chunks.
byte[] chunk = new byte[bHandle.getChunkSize()];
int i = -1;

while ((i = instream.read(chunk)) != -1) {
outstream.write(chunk, 0, i);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {

// Close the input and output stream.
if (instream != null) {
instream.close();
instream = null ;
}

if (outstream != null) {
outstream.close();
outstream = null ;
}

} catch (IOException e) {
e.printStackTrace();
}
}
}

public void setPath(String path)
{
this.PATH = path ;
}
/**
* Get a file handle
*/
private void getFileHandle()
{
fHandle = new File(PATH + fileName);
}
}

EA
1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 5 2017
Added on Dec 2 2016
26 comments
13,644 views