GUAC-718: Set locale (for sake of wcwidth()). Warn if locale does not use UTF-8.
This commit is contained in:
parent
b106e13bb1
commit
c84a88d35a
@ -28,6 +28,8 @@
|
||||
#include "ssh_client.h"
|
||||
#include "terminal.h"
|
||||
|
||||
#include <langinfo.h>
|
||||
#include <locale.h>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -130,6 +132,11 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Set locale and warn if not UTF-8 */
|
||||
setlocale(LC_CTYPE, "");
|
||||
if (strcmp(nl_langinfo(CODESET), "UTF-8") != 0)
|
||||
guac_client_log_info(client, "Current locale does not use UTF-8. Some characters may not render correctly.");
|
||||
|
||||
/* Read parameters */
|
||||
strcpy(client_data->hostname, argv[IDX_HOSTNAME]);
|
||||
strcpy(client_data->username, argv[IDX_USERNAME]);
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "telnet_client.h"
|
||||
#include "terminal.h"
|
||||
|
||||
#include <langinfo.h>
|
||||
#include <locale.h>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -92,6 +94,11 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Set locale and warn if not UTF-8 */
|
||||
setlocale(LC_CTYPE, "");
|
||||
if (strcmp(nl_langinfo(CODESET), "UTF-8") != 0)
|
||||
guac_client_log_info(client, "Current locale does not use UTF-8. Some characters may not render correctly.");
|
||||
|
||||
/* Read parameters */
|
||||
strcpy(client_data->hostname, argv[IDX_HOSTNAME]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user