yara-x icon indicating copy to clipboard operation
yara-x copied to clipboard

Add a command-line option for automatic encoding conversion

Open plusvic opened this issue 1 year ago • 0 comments

When a source file contains an invalid UTF-8 character, YARA-X fails with an error like this:

error: invalid UTF-8
 --> test.yar:3:19
  |
3 |     author = "John Smith � "
  |                          ^ invalid UTF-8 character
  |

By using the chardetng and encoding_rs crates, the encoding of the original source file could be automatically detected and then converted to UTF-8, before the source code is passed to the parser.

This automatic encoding conversion would be performed only when the --force-utf-8 option is passed to the CLI.

plusvic avatar May 17 '24 18:05 plusvic