[Asterisk-code-review] func_odbc: acf_odbc_read() and cli_odbc_read() unicode support (...asterisk[master])

Alexei Gradinari asteriskteam at digium.com
Wed Sep 4 14:08:45 CDT 2019


Alexei Gradinari has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/12812 )

Change subject: func_odbc:  acf_odbc_read() and cli_odbc_read() unicode support
......................................................................


Patch Set 4:

> Patch Set 4:
> 
> > Patch Set 4:
> > 
> > > Patch Set 4:
> > > 
> > > > The problem is going to be converting the UCS-2 into UTF-8. From what I have read, when using the MS ODBC library, there are no client character set options, so you may have to roll your own method to do the character set conversion (which I believe is non-trivial).
> > > 
> > > I may be wrong about this. It looks like it _is_ doing the conversion. I wrote a simple program using the ODBC API and this is the output:
> > > 
> > >  UnicodeThing: АБВГДЕЖЗИК
> > > 
> > > A hexdump indicates that the first character is \xd0\x90 (utf-8 encoding for "CYRILLIC CAPITAL LETTER A").
> > 
> > Additionally, when I enabled ODBC tracing and used the 'isql' utility to run a SELECT, it pulls back the correct UTF-8 representation but only ever passes SQL_DESC_DISPLAY_SIZE to SQLColAttribute.
> 
> I think that the correct fix is going to be to modify ast_odbc_ast_str_SQLGetData() to retrieve the data in parts, as documented here:
> 
> https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetdata-function?view=sql-server-2017#retrieving-variable-length-data-in-parts
> 
> ... OR we can just allocate a large buffer (4k or something) and not care if we truncate.
> 
> In short, I don't think we should be making any calls to SQLColAttribute.

Agree.
The res_config_odbc module already retrieves the data in parts.


-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/12812
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I50e86c8a277996f13d4a4b9b318ece0d60b279bf
Gerrit-Change-Number: 12812
Gerrit-PatchSet: 4
Gerrit-Owner: Boris P. Korzun <drtr0jan at yandex.ru>
Gerrit-Reviewer: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Boris P. Korzun <drtr0jan at yandex.ru>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-CC: Sean Bright <sean.bright at gmail.com>
Gerrit-Comment-Date: Wed, 04 Sep 2019 19:08:45 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190904/d5882555/attachment.html>


More information about the asterisk-code-review mailing list