Open bkmgit opened 9 months ago
The following works correctly:
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <recodext.h>
const char *program_name;
int main (int argc, char *const *argv)
{
program_name = argv[0];
RECODE_OUTER outer = recode_new_outer (true);
RECODE_REQUEST request = recode_new_request (outer);
request->verbose_flag = true;
char input_buffer[10] = "Äpfel";
char *output_buffer;
size_t output_length;
size_t input_length = 6;
size_t output_allocated = 20;
output_buffer = (char*)malloc(output_allocated * sizeof(char));
bool success;
success = recode_scan_request (request, "latin1..ascii");
RECODE_TASK task = recode_new_task(request);
task->fail_level = RECODE_NOT_CANONICAL;
task->abort_level = RECODE_NOT_CANONICAL;
task->input.buffer = input_buffer;
task->input.cursor = input_buffer;
task->input.limit = input_buffer + input_length;
task->output.buffer = output_buffer;
task->output.cursor = output_buffer;
task->output.limit = output_buffer + output_allocated;
printf("Starting task\n");
success = recode_perform_task (task);
printf("Task complete\n");
output_buffer = task->output.buffer;
output_length = task->output.cursor - task->output.buffer;
output_allocated = task->output.limit - task->output.buffer;
recode_delete_task (task);
if (success) printf("%s\n",output_buffer);
free(output_buffer);
recode_delete_request (request);
recode_delete_outer (outer);
exit (success ? 0 : 1);
}
Thanks for this. I'm sorry, but my time to work on Recode is limited at present, and librecode is not a high priority. If you can provide any further analysis, I'd be most grateful; otherwise, I'll look at it when I can!
When testing AnyMeal, on Fedora 38, found that the program below
hangs and does not print
Task Complete
. If one changesÄpfel
toApfel
it works. Attempting the conversion from the command line does however issue an error message that the input is untranslatable. This is with release 3.7.14