Skip to content
Snippets Groups Projects
Commit 067556d7 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Strip CP437 "graphics" characters in prep_file_desc()

If the extended description is UTF-8, first convert it to CP437.
parent a710f6ff
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "scfglib.h" #include "scfglib.h"
#include "sauce.h" #include "sauce.h"
#include "crc32.h" #include "crc32.h"
#include "utf8.h"
/* libarchive: */ /* libarchive: */
#include <archive.h> #include <archive.h>
...@@ -1082,10 +1083,13 @@ char* prep_file_desc(const char* ext, char* dest) ...@@ -1082,10 +1083,13 @@ char* prep_file_desc(const char* ext, char* dest)
char* src; char* src;
char* buf = strdup(ext); char* buf = strdup(ext);
if(buf == NULL) if(buf == NULL)
src = (char*)ext; return NULL;
else { src = buf;
src = buf; strip_ctrl(src, src);
strip_ctrl(src, src); if(!str_is_ascii(src)) {
if(utf8_str_is_valid(src))
utf8_to_cp437_inplace(src);
strip_cp437_graphics(src, src);
} }
FIND_ALPHANUMERIC(src); FIND_ALPHANUMERIC(src);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment