Skip to content
Snippets Groups Projects
big-endian.patch 531 B
--- a/char_conv.c
+++ b/char_conv.c
@@ -132,7 +132,13 @@ EXPORT_DEF ssize_t gsm7_encode(const uint16_t *in, size_t in_length, uint16_t *o
 {
 	// TODO: Should we check for other tables or just use UCS-2?
 	unsigned bytes = 0;
-	const uint8_t *escenc = get_char_gsm7_encoding(0x1B00);
+	const uint8_t *escenc = get_char_gsm7_encoding(
+#if __BYTE_ORDER == __BIG_ENDIAN
+		0x001B
+#else
+		0x1B00
+#endif
+	);
 	for (unsigned i = 0; i < in_length; ++i) {
 		const uint8_t *enc = get_char_gsm7_encoding(in[i]);
 		uint8_t c = enc[0];