title: Firebird connection charset
body: <p>I have problem adding a new user to Firebird database service running on localhost. Call of client library fbclient.dll method <em>isc_add_user</em> fails with error codes 335544754 (isc_error_adding_sec_record) and 335544849 (isc_malformed_string). The problem is clearly related to diacritics. This is relevant part of source code:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>bool FirebirdService::AddUser(User &amp;user)
  {
     ISC_STATUS status[20] = { 0 };
     USER_SEC_DATA data = { 0 };
     AnsiString server = (ip == L"localhost") || ip.IsEmpty() ? AnsiString("localhost") : AnsiString(ip);
     AnsiString dba_user_name = app_config.AdminUser;
     AnsiString dba_password = app_config.AdminPassword;
     AnsiString name = user.GetLogin();
     AnsiString password = user.GetPassword();
     AnsiString first_name = user.GetFirstName();
     AnsiString last_name = user.GetLastName();
  
     data.sec_flags = sec_dba_user_name_spec | sec_dba_password_spec | sec_first_name_spec | sec_last_name_spec;
     data.server = server.c_str();
     data.protocol = (ip == L"localhost") || ip.IsEmpty() ? sec_protocol_local : sec_protocol_tcpip;
     data.dba_user_name = dba_user_name.c_str();
     data.dba_password = dba_password.c_str();
     data.user_name = name.c_str();
     data.first_name = first_name.c_str();
     data.last_name = last_name.c_str();
     data.password = password.c_str();
     if (isc_add_user(status, &amp;data))
     {
        return false;
     }
  
     return true;
  }
  </code></pre>
  
  <p>This is byte content of structure field data.first_name:</p>
  
  <p>[0] 'J' 74 (0x4A)</p>
  
  <p>[1] 'á' -31 (0xE1)</p>
  
  <p>[2] 'n' 110 (0x6E)</p>
  
  <p>[3] '\0' 0 (0x00)</p>
  
  <p>As soon as I change second character 'á' to 'a' the call to <em>isc_add_user</em> succeeds. How should I properly handle this kind of situation ? Is there a way to change connection charset to utf-8 or utf-16 ?</p>