0c56fe6958f347b5ab7070725114c7d4c216bc87 braney Mon Nov 13 15:19:40 2017 -0800 catch weird strings in position boxes diff --git src/lib/windowsToAscii.c src/lib/windowsToAscii.c new file mode 100644 index 0000000..d8f12dd --- /dev/null +++ src/lib/windowsToAscii.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2017 The Regents of the University of California + * * See README in this or parent directory for licensing information. */ + +#include "iconv.h" +#include "common.h" + +char *windowsToAscii(char *input) +/* Convert windows-1250 to ascii. */ +{ +if (input == NULL) + return NULL; + +iconv_t convType = iconv_open("ASCII//TRANSLIT", "WINDOWS-1250/"); +size_t inSize = strlen(input); +size_t outSize = 1024; +char buffer[outSize]; +char *outString = buffer; +char *inPtr = input; +iconv(convType, &inPtr, &inSize, &outString, &outSize); +*outString = 0; +fprintf(stderr, "BRANEY converted %s to %s\n", input, buffer); + +return cloneString(buffer); +}