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:51:19 -0600
commit52b2ed4560172d785c9687ef728d7925a21c3ae8 (patch)
tree44b4a624a7f92ee2ac6b3a8c71ee3ca3d5c0b923
parent231acfe4d2fd5ea8feb6e962325f530e24b86623 (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 (cherry picked from commit cd252068e94ea1edff177e5abe93c38c5eb6a037)
-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 52f585a94..fc2c3e8c8 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;
}