summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2020-04-22 07:48:33 -0600
committerJohn Stebbins <[email protected]>2020-04-22 07:50:42 -0600
commitcd252068e94ea1edff177e5abe93c38c5eb6a037 (patch)
treef2c384502867c0c88cdf6bc3c5637ed0d55878f2
parent56f64e0f510e4df8e95167da31a0a3f55fe737cc (diff)
hb_dict: fix loading preset files with unicode path
Thanks to Pierce Lopez for pointing out a solution Fixes https://github.com/HandBrake/HandBrake/issues/2427
-rw-r--r--libhb/hb_dict.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libhb/hb_dict.c b/libhb/hb_dict.c
index 0dbd5c80b..439e74f59 100644
--- a/libhb/hb_dict.c
+++ b/libhb/hb_dict.c
@@ -92,8 +92,16 @@ hb_value_t * hb_value_json(const char *json)
hb_value_t * hb_value_read_json(const char *path)
{
+ FILE * fp;
json_error_t error;
- hb_value_t *val = json_load_file(path, 0, &error);
+
+ fp = hb_fopen(path, "r");
+ if (fp == NULL)
+ {
+ return NULL;
+ }
+ hb_value_t *val = json_loadf(fp, 0, &error);
+ fclose(fp);
return val;
}