Example: lr_convert_string_encoding
In the following example, lr_convert_string_encoding converts the string "Hello world" from the system locale to Unicode.
Note: The output displays printable characters as the characters themselves, followed by their terminating NULLs. Non-printable characters would be displayed in Hexadecimal.
Action() { int rc = 0; unsigned long converted_buffer_size_unicode = 0; char *converted_buffer_unicode = NULL; rc = lr_convert_string_encoding("Hello world", LR_ENC_SYSTEM_LOCALE, LR_ENC_UNICODE, "stringInUnicode"); if(rc < 0) { // error } return 0; }
Example: Output:
Starting action Action.
Action.c(7): Notify: Saving Parameter "stringInUnicode = H\x00e\x00l\x00l\x00o\x00 \x00w\x00o\x00r\x00l\x00d\x00\x00\x00"
Ending action Action.