<blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Patch Set 4:</p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Patch Set 4:</p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">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).</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">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:</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> UnicodeThing: АБВГДЕЖЗИК</pre><p style="white-space: pre-wrap; word-wrap: break-word;">A hexdump indicates that the first character is \xd0\x90 (utf-8 encoding for "CYRILLIC CAPITAL LETTER A").</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">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.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">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:</p><p style="white-space: pre-wrap; word-wrap: break-word;">https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetdata-function?view=sql-server-2017#retrieving-variable-length-data-in-parts</p><p style="white-space: pre-wrap; word-wrap: break-word;">... OR we can just allocate a large buffer (4k or something) and not care if we truncate.</p><p style="white-space: pre-wrap; word-wrap: break-word;">In short, I don't think we should be making any calls to SQLColAttribute.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/12812">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/12812">change 12812</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/12812"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I50e86c8a277996f13d4a4b9b318ece0d60b279bf </div>
<div style="display:none"> Gerrit-Change-Number: 12812 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Boris P. Korzun <drtr0jan@yandex.ru> </div>
<div style="display:none"> Gerrit-Reviewer: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Boris P. Korzun <drtr0jan@yandex.ru> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-CC: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Wed, 04 Sep 2019 18:24:16 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Gerrit-MessageType: comment </div>