diff --git a/res/res_fax.c b/res/res_fax.c
index 190ba1b850f533abb44bd52c644839f527cb7590..9619afaa19ccbb82142a68d762289193944a0c83 100644
--- a/res/res_fax.c
+++ b/res/res_fax.c
@@ -1451,8 +1451,8 @@ static void set_channel_variables(struct ast_channel *chan, struct ast_fax_sessi
 	pbx_builtin_setvar_helper(chan, "FAXSTATUS", S_OR(details->result, NULL));
 	pbx_builtin_setvar_helper(chan, "FAXERROR", S_OR(details->error, NULL));
 	pbx_builtin_setvar_helper(chan, "FAXSTATUSSTRING", S_OR(details->resultstr, NULL));
-	pbx_builtin_setvar_helper(chan, "REMOTESTATIONID", S_OR(details->remotestationid, NULL));
-	pbx_builtin_setvar_helper(chan, "LOCALSTATIONID", S_OR(details->localstationid, NULL));
+	pbx_builtin_setvar_helper(chan, "REMOTESTATIONID", AST_JSON_UTF8_VALIDATE(details->remotestationid));
+	pbx_builtin_setvar_helper(chan, "LOCALSTATIONID", AST_JSON_UTF8_VALIDATE(details->localstationid));
 	pbx_builtin_setvar_helper(chan, "FAXBITRATE", S_OR(details->transfer_rate, NULL));
 	pbx_builtin_setvar_helper(chan, "FAXRESOLUTION", S_OR(details->resolution, NULL));
 
@@ -2036,11 +2036,11 @@ static int report_receive_fax_status(struct ast_channel *chan, const char *filen
 		const char *fax_bitrate;
 		SCOPED_CHANNELLOCK(lock, chan);
 
-		remote_station_id = S_OR(pbx_builtin_getvar_helper(chan, "REMOTESTATIONID"), "");
+		remote_station_id = AST_JSON_UTF8_VALIDATE(pbx_builtin_getvar_helper(chan, "REMOTESTATIONID"));
 		if (!ast_strlen_zero(remote_station_id)) {
 			remote_station_id = ast_strdupa(remote_station_id);
 		}
-		local_station_id = S_OR(pbx_builtin_getvar_helper(chan, "LOCALSTATIONID"), "");
+		local_station_id = AST_JSON_UTF8_VALIDATE(pbx_builtin_getvar_helper(chan, "LOCALSTATIONID"));
 		if (!ast_strlen_zero(local_station_id)) {
 			local_station_id = ast_strdupa(local_station_id);
 		}
@@ -2543,11 +2543,11 @@ static int report_send_fax_status(struct ast_channel *chan, struct ast_fax_sessi
 		const char *fax_bitrate;
 		SCOPED_CHANNELLOCK(lock, chan);
 
-		remote_station_id = S_OR(pbx_builtin_getvar_helper(chan, "REMOTESTATIONID"), "");
+		remote_station_id = AST_JSON_UTF8_VALIDATE(pbx_builtin_getvar_helper(chan, "REMOTESTATIONID"));
 		if (!ast_strlen_zero(remote_station_id)) {
 			remote_station_id = ast_strdupa(remote_station_id);
 		}
-		local_station_id = S_OR(pbx_builtin_getvar_helper(chan, "LOCALSTATIONID"), "");
+		local_station_id = AST_JSON_UTF8_VALIDATE(pbx_builtin_getvar_helper(chan, "LOCALSTATIONID"));
 		if (!ast_strlen_zero(local_station_id)) {
 			local_station_id = ast_strdupa(local_station_id);
 		}