1
/* -*- c-basic-offset: 8 -*-
2
FreeRDP: A Remote Desktop Protocol client.
4
Copyright (C) Marc-Andre Moreau <marcandre.moreau@gmail.com> 2010
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25
#include "chan_stream.h"
28
set_wstr(char* dst, int dstlen, char* src, int srclen)
34
cd = iconv_open("UTF-16LE", "UTF-8");
35
if (cd == (iconv_t) - 1)
37
printf("set_wstr: iconv_open failed.\n");
40
in_size = (size_t)srclen;
41
avail = (size_t)dstlen;
42
iconv(cd, &src, &in_size, &dst, &avail);
44
return dstlen - (int)avail;
48
get_wstr(char* dst, int dstlen, char* src, int srclen)
54
cd = iconv_open("UTF-8", "UTF-16LE");
55
if (cd == (iconv_t) - 1)
57
printf("set_wstr: iconv_open failed.\n");
60
in_size = (size_t)srclen;
61
avail = (size_t)dstlen;
62
iconv(cd, &src, &in_size, &dst, &avail);
64
return dstlen - (int)avail;