BeOS: implement charset conversion.

This commit is contained in:
Adrien Destugues 2015-04-26 16:56:44 +02:00
parent 83f03d417a
commit c97be8dbb2

View File

@ -32,6 +32,7 @@
#include <fs_attr.h>
#include <support/TypeConstants.h>
#include <support/UTF8.h>
#include <storage/Mime.h>
#include "extfs.h"
@ -458,3 +459,29 @@ bool extfs_rename(const char *old_path, const char *new_path)
{
return rename(old_path, new_path) == 0;
}
/*
* Strings (filenames) conversion
*/
// Convert from the host OS filename encoding to MacRoman
const char *host_encoding_to_macroman(const char *filename)
{
int32 state = 0;
static char buffer[512];
int32 size = sizeof(buffer) - 1;
int32 insize = strlen(filename);
convert_from_utf8(B_MAC_ROMAN_CONVERSION, filename, &insize, buffer, &size, &state);
return buffer;
}
// Convert from MacRoman to host OS filename encoding
const char *macroman_to_host_encoding(const char *filename)
{
int32 state = 0;
static char buffer[512];
int32 insize = strlen(filename);
int32 size = sizeof(buffer) - 1;
convert_to_utf8(B_MAC_ROMAN_CONVERSION, filename, &insize, buffer, &size, &state);
return buffer;
}