utf-conv.c 565 Bytes
Newer Older
1
/*
Edward Thomson committed
2
 * Copyright (C) the libgit2 contributors. All rights reserved.
3 4 5 6 7 8
 *
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 * a Linking Exception. For full terms see the included COPYING file.
 */

#include "common.h"
9 10
#include "utf-conv.h"

11
int git__utf8_to_16(wchar_t * dest, size_t dest_size, const char *src)
12
{
Ben Straub committed
13
	return MultiByteToWideChar(CP_UTF8, 0, src, -1, dest, (int)dest_size);
14
}
Vicent Martí committed
15

16
int git__utf16_to_8(char *dest, size_t dest_size, const wchar_t *src)
17
{
Ben Straub committed
18
	return WideCharToMultiByte(CP_UTF8, 0, src, -1, dest, (int)dest_size, NULL, NULL);
19
}