• Nvarchar versus UTF-8 varchar

    From Roy Hann@specially@processed.almost.meat to comp.databases.ingres on Wed Jul 28 13:14:41 2021
    From Newsgroup: comp.databases.ingres

    A colleague has asked a question for which I have no answer.

    When II_CHARSETxx is UTF8 what is the difference between VARCHAR and
    NVARCHAR?

    I know NVARCHAR uses UTF-16.

    Why might I use NVARCHAR if my data can be represented with VARCHAR?

    Roy
    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Karl Schendel@schendel@kbcomputer.com to info-ingres on Wed Jul 28 09:22:52 2021
    From Newsgroup: comp.databases.ingres


    On Jul 28, 2021, at 9:14 AM, Roy Hann <specially@processed.almost.meat> wrote:

    A colleague has asked a question for which I have no answer.

    When II_CHARSETxx is UTF8 what is the difference between VARCHAR and NVARCHAR?

    I know NVARCHAR uses UTF-16.
    Actually, I think NVARCHAR uses UCS-2, at least on the Ingres side. That's
    not quite the same thing.

    Why might I use NVARCHAR if my data can be represented with VARCHAR?
    I think the answer is probably "you wouldn't".
    I do try to remain as ignorant of characters as possible, though.
    Karl
    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Adrian Williamson@adrian.williamson@rationalcommerce.com to 'Karl Schendel' on Wed Jul 28 14:38:20 2021
    From Newsgroup: comp.databases.ingres

    Hi

    I think NVARCHAR only survived a very limited number of OR versions before technology moved on:

    From the OR manuals:

    *OpenROAD transparent Unicode support negates the need for nchar and
    nvarchar data types to be used in OpenROAD 4GL applications. The nchar and nvarchar data types, introduced in OpenROAD 5.0, can be used only in a
    limited number of ways. The varchar data type with UTF8 encoding is all that
    is needed for Unicode support; to prevent nchar and nvarchar data types from being used accidentally, setthe environment variable,
    II_W4GL_ALLOW_NVARCHAR, to FALSE. If the variable is set to TRUE (the
    default), the nchar and nvarchar data types may be declared and used in OpenROAD 4GL applications. For more information about
    II_W4GL_ALLOW_NVARCHAR, see the Workbench User Guide.
    Another environment variable, II_W4GL_PASS_NVARCHAR_AS_WCHAR, if set to
    TRUE, will pass any user 3GL procedure parameters of the data type nvarchar
    as wide chars to the user 3GL procedure. If it is set to FALSE, nvarchars
    will be coerced to chars before passing them to the user 3GL procedure. The default is FALSE. For more information about II_W4GL_PASS_NVARCHAR_AS_WCHAR, see the Workbench User Guide.

    So I would avoid using it at all unless you are very special.

    Cheers

    Adrian

    -----Original Message-----
    From: info-ingres-bounces@lists.planetingres.org <info-ingres-bounces@lists.planetingres.org> On Behalf Of Karl Schendel
    Sent: 28 July 2021 14:23
    To: info-ingres@lists.planetingres.org
    Subject: Re: [Info-ingres] Nvarchar versus UTF-8 varchar


    On Jul 28, 2021, at 9:14 AM, Roy Hann <specially@processed.almost.meat>
    wrote:

    A colleague has asked a question for which I have no answer.

    When II_CHARSETxx is UTF8 what is the difference between VARCHAR and NVARCHAR?

    I know NVARCHAR uses UTF-16.

    Actually, I think NVARCHAR uses UCS-2, at least on the Ingres side. That's
    not quite the same thing.


    Why might I use NVARCHAR if my data can be represented with VARCHAR?

    I think the answer is probably "you wouldn't".

    I do try to remain as ignorant of characters as possible, though.

    Karl

    _______________________________________________
    Info-ingres mailing list
    Info-ingres@lists.planetingres.org https://lists.planetingres.org/mailman/listinfo/info-ingres

    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Roy Hann@specially@processed.almost.meat to comp.databases.ingres on Wed Jul 28 14:15:43 2021
    From Newsgroup: comp.databases.ingres

    Karl Schendel wrote:

    I know NVARCHAR uses UTF-16.

    Actually, I think NVARCHAR uses UCS-2, at least on the Ingres side. That's not quite the same thing.

    No, it's not. I take that to mean the difference has never mattered
    enough. :-)

    Why might I use NVARCHAR if my data can be represented with VARCHAR?

    I think the answer is probably "you wouldn't".

    Deal.

    Roy
    --- Synchronet 3.21b-Linux NewsLink 1.2