mailing list of musl libc
 help / color / mirror / code / Atom feed
* Iconv and old codepages
@ 2013-06-26 18:15 orc
  2013-06-26 18:34 ` Rich Felker
  2013-06-26 18:39 ` LM
  0 siblings, 2 replies; 7+ messages in thread
From: orc @ 2013-06-26 18:15 UTC (permalink / raw)
  To: musl list

[-- Attachment #1: Type: text/plain, Size: 547 bytes --]

Hi,

How many codepages does in-musl iconv supports?
Currently I'm trying converting from "utf8" to "cp1251" and iconv()
only gives me a number of "*"'s matching the utf8 input. Is this
correct behavior and iconv() currently does not support non-UTF legacy
codepages? Even so, I still see many of them in src/locale/codepages.h
The (dirty) test program attached.

I also noticed alternative libs thread and corresponding wiki page.
Does someone know lightweight iconv replacement as a temporary measure
(other than libiconv for example)?

Regards.

[-- Attachment #2: ticonv.c --]
[-- Type: application/octet-stream, Size: 384 bytes --]

#include <stdio.h>
#include <iconv.h>
#include <string.h>

int main(void)
{
	char c[] = "\xd1\x82\xd0\xb5\xd1\x81\xd1\x82", *tc = c;
	char to[512] = {0}, *out = to;
	size_t f, t;
	iconv_t cd;
	
	cd = iconv_open("cp1251", "utf8");
	if (cd == (iconv_t)(-1)) return 1;
	f = strlen(c);
	t = sizeof(to);
	iconv(cd, &tc, &f, &out, &t);
	printf("%s\n", to);

	iconv_close(cd);

	return 0;
}

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-06-27  1:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-26 18:15 Iconv and old codepages orc
2013-06-26 18:34 ` Rich Felker
2013-06-26 18:56   ` orc
2013-06-26 18:39 ` LM
2013-06-26 18:47   ` Rich Felker
2013-06-27  0:37   ` Isaac
2013-06-27  1:25     ` Luca Barbato

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).