diff uptools/atcmd/smsend_main.c @ 967:6bf473f77fc4

fcup-smsend: support backslash escapes in UCS-2 mode too
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 01 Sep 2023 16:43:35 +0000
parents ec7e23d5151f
children
line wrap: on
line diff
--- a/uptools/atcmd/smsend_main.c	Fri Sep 01 15:44:52 2023 +0000
+++ b/uptools/atcmd/smsend_main.c	Fri Sep 01 16:43:35 2023 +0000
@@ -82,11 +82,6 @@
 			argv[0]);
 		exit(ERROR_USAGE);
 	}
-	if (ucs2_mode && allow_escape) {
-		fprintf(stderr, "%s error: UCS-2 escapes not supported yet\n",
-			argv[0]);
-		exit(ERROR_USAGE);
-	}
 	if (argc > optind + 2) {
 		fprintf(stderr, "usage: %s [options] dest-addr [message]\n",
 			argv[0]);
@@ -257,7 +252,8 @@
 	u_char udh[5];
 	unsigned pos, remain, chunk;
 
-	rc = utf8_to_ucs2(msgtext, msgtext_uni, MAX_MSG_UNI, &msgtext_unilen);
+	rc = utf8_to_ucs2(msgtext, msgtext_uni, MAX_MSG_UNI, &msgtext_unilen,
+			  allow_escape);
 	if (rc == -1) {
 		fprintf(stderr, "error: invalid UTF-8 message\n");
 		exit(ERROR_USAGE);
@@ -266,6 +262,11 @@
 		fprintf(stderr, "error: message too long for max concat SMS\n");
 		exit(ERROR_USAGE);
 	}
+	if (rc == -3) {
+		fprintf(stderr,
+			"error: message contains invalid backslash escape\n");
+		exit(ERROR_USAGE);
+	}
 	if (msgtext_unilen <= 70) {
 		common_init();
 		prep_for_pdu_mode();