Use proper unicode lowercasing
This commit is contained in:
+17
-1
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: unacpp.cpp,v 1.4 2005-11-24 07:16:15 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: unacpp.cpp,v 1.5 2006-01-05 16:37:26 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#ifndef TEST_UNACPP
|
||||
@@ -33,6 +33,22 @@ bool unac_cpp(const std::string &in, std::string &out, const char *encoding)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool unac_cpp_utf16be(const std::string &in, std::string &out)
|
||||
{
|
||||
char *cout = 0;
|
||||
size_t out_len;
|
||||
|
||||
if (unac_string_utf16(in.c_str(), in.length(), &cout, &out_len) < 0) {
|
||||
char cerrno[20];
|
||||
sprintf(cerrno, "%d", errno);
|
||||
out = string("unac_string failed, errno : ") + cerrno;
|
||||
return false;
|
||||
}
|
||||
out.assign(cout, out_len);
|
||||
free(cout);
|
||||
return true;
|
||||
}
|
||||
|
||||
#else // not testing
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
+2
-1
@@ -1,11 +1,12 @@
|
||||
#ifndef _UNACPP_H_INCLUDED_
|
||||
#define _UNACPP_H_INCLUDED_
|
||||
/* @(#$Id: unacpp.h,v 1.1 2004-12-17 15:36:13 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
/* @(#$Id: unacpp.h,v 1.2 2006-01-05 16:37:26 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
|
||||
#include <string>
|
||||
|
||||
// A small wrapper for unac.c
|
||||
extern bool unac_cpp(const std::string &in, std::string &out,
|
||||
const char *encoding = "UTF-8");
|
||||
extern bool unac_cpp_utf16be(const std::string &in, std::string &out);
|
||||
|
||||
#endif /* _UNACPP_H_INCLUDED_ */
|
||||
|
||||
Reference in New Issue
Block a user