1. Steven Turner
  2. PowerBuilder
  3. Friday, 24 January 2020 01:23 AM UTC

Good evening,

We have application using the default character set going against an Oracle 12c back-end. We have to occasionally enter customers with Spanish names. We are in the process of updating the affected table column definitions from VARCHAR2 TO NVARCHAR2.

The question is how do we create data objects that can display the Spanish characters?
Thanks in advance....

Steve

 

Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 24 January 2020 18:32 PM UTC
  2. PowerBuilder
  3. # Permalink

It's because of the character set US7ASCII you are using:

 

USE AL32UTF8 and everything will work:

 

 

Depending on which version of Oracle you are, the way to change the character set might be different, so be carefull, do a backup and google a bit on how to do this.

Kind regards,

MiguelL

Comment
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Tuesday, 28 January 2020 02:41 AM UTC
  2. PowerBuilder
  3. # 1

PowerBuilder's ORA database driver has several settings that impact character set encoding. Here is a list (see docs for details) referring to both DBParm parameter name and location on Database Profile dialog:

  • Tab = Connection
    • NCharLiteral = 1

  • Tab = System
    • NLS_Charset = 'Unicode' (Unicode is default)

  • Tab = Transction
    • NCharBind = 1
    • DisableBind = 0
    • NOTE: DisableBind=0 required for NCharBind=1 to take effect!

Good luck with your Spanish characters /Michael

Comment
  1. Miguel Leeuwe
  2. Tuesday, 28 January 2020 03:01 AM UTC
Hi Michael,

I'm not sure, but I don't think setting the NLS_Charset in the dbparm is enough: The database itself must be set to AL32UTF8.

There's tools to do this, but they depend on which version of Oracle you are and they have a risk of data corruption and or data loss. The safest way to do this:

- backup your database completely

- then export your database

- create a new empty database with the correct al32utf8 setting

- import your data

regards,
  1. Helpful
  1. Michael Kramer
  2. Tuesday, 28 January 2020 03:24 AM UTC
True. This reply was just meant as recap of DBParm settings for strings on the client. Database also has to be setup as you discussed in prior replies.

Character sets and collations can turn sorting and comparison into utter randomness.
  1. Helpful
There are no comments made yet.
Steven Turner Accepted Answer Pending Moderation
  1. Friday, 24 January 2020 12:24 PM UTC
  2. PowerBuilder
  3. # 2

I'm using TOAD and that's how entered values into the table.
Entering Spanish characters in the NVARCHAR2 columns remain intact.
Entering Spanish characters in VARCHAR2 immediately switch upon commit (assume its the US7ASCII)

Comment
  1. Michael Kramer
  2. Friday, 24 January 2020 12:36 PM UTC
You're right. There are probably some settings stipulating accents will be removed and other character "massage".
  1. Helpful
There are no comments made yet.
Steven Turner Accepted Answer Pending Moderation
  1. Friday, 24 January 2020 12:21 PM UTC
  2. PowerBuilder
  3. # 3

The NLS_CHARACTERSET on our database is US7ASCII
The NLS_NCHAR_CHARACTERSET is AL16UTF16

Comment
  1. Michael Kramer
  2. Friday, 24 January 2020 12:37 PM UTC
And exactly THIS is where I would like to compare to an Oracle install where Spanish character are NOT lost . . .

With some luck others will join this Q&A thread within a few hours.

I'm certain this is fixable. Just a matter of turning the right wheel after comparing to working setup.
  1. Helpful
  1. Miguel Leeuwe
  2. Friday, 24 January 2020 18:07 PM UTC
try NLS_CHARACTERSET AL32UTF8

instead of US7ASCII
  1. Helpful
There are no comments made yet.
Steven Turner Accepted Answer Pending Moderation
  1. Friday, 24 January 2020 11:28 AM UTC
  2. PowerBuilder
  3. # 4


I created a test table with First_name, last_name columns (both NVARCHAR2(30))

Entered: Estában Turñer

Saved to the database and created a Grid datawindow.
It displays: Estaban Tur?er

Why am I losing the character over the "a" and the tilde n converting to "?"

Sidenote:
I created varchar2 equivalent fields and they won't save the Spanish characters

Comment
  1. Michael Kramer
  2. Friday, 24 January 2020 12:15 PM UTC
That looks like some character set conversions interfering with UTF-16 <=> UTF-16. Losing accents on a (or other vowels) is often indicator of some unexpected setup for collation and/or character set.

How is your NVARCHAR2(30) column defined regarding character set/collation/etc.? Some settings can be set at database(server) level as I remember.

How is your connection setup? Any character encodings/translations?

If you have TOAD or similar tool involved => What happens if you insert/update and select Spanish characters using that tool?
  1. Helpful
  1. Michael Kramer
  2. Friday, 24 January 2020 12:17 PM UTC
To rest of the community: Anyone have an Oracle database with NVARCHAR2 column where Spanish words like "año" can be inserted/updated and later retrieved successfully using PB DataWindows?

I don't have an Oracle setup available right now so I can't check details.
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 24 January 2020 06:15 AM UTC
  2. PowerBuilder
  3. # 5

Hi as Michael already said: you don't have to do anything.

If I'm not mistaken, Varchar2 should be perfectly capable to handle Spanish characters. No need to convert to nvarchar2

What might be more important though, is the language setting of your database:

select * from nls_database_parameters where parameter like '%CHARACTERSET';

I'd recommend setting NLS_CHARACTERSET to UTF8 and NLS_NCHAR_CHARACTERSET to UTF16.
They way to asssign that might be different depending on your Oracle version. (like UTF8 vs. AL32UTF8 ).

This is my output:
NLS_CHARACTERSET AL32UTF8
NLS_NCHAR_CHARACTERSET AL16UTF16


Comment
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Friday, 24 January 2020 02:42 AM UTC
  2. PowerBuilder
  3. # 6

Hi, no problem - nothing extra to do as I remember.

PB uses UTF-16 internally. Which means any text field in PowerBuilder can display any Unicode character if your font supports that character. Some fonts included with Windows support specific character sets. You will find support for Spanish ñ in close to all character sets also supporting English A-Z. Can think of one that doesn't support it.

NVARCHAR2 is Oracle's name for Unicode in UTF-16. You just have to learn the keyboard combo for ñ and Ñ and you are good to go.

As soon as you are on NVARCHAR2 you can also handle all the other funny character we use around Europe - my Danish Æ Ø Å - Swedish Ä Ö Å for the same characters. And everything else in Unicode like Japanese, Greek, and Hebrew to name a few. - again, as long as your character set supports those characters.

Enjoy /Michael

TIP: Nice Unicode lookup page https://www.compart.com/en/unicode/
Sample search for ñ delivers https://www.compart.com/en/unicode/U+00F1

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.