+ tap_code(hex_to_keycode(digit));
+ }
+}
+
+void send_unicode_hex_string(const char *str) {
+ if (!str) { return; }
+
+ while (*str) {
+ // Find the next code point (token) in the string
+ for (; *str == ' '; str++);
+ size_t n = strcspn(str, " "); // Length of the current token
+ char code_point[n+1];
+ strncpy(code_point, str, n);
+ code_point[n] = '\0'; // Make sure it's null-terminated
+
+ // Normalize the code point: make all hex digits lowercase
+ for (char *p = code_point; *p; p++) {
+ *p = tolower((unsigned char)*p);
+ }
+
+ // Send the code point as a Unicode input string
+ unicode_input_start();
+ send_string(code_point);
+ unicode_input_finish();
+
+ str += n; // Move to the first ' ' (or '\0') after the current token
+ }
+}
+
+bool process_unicode_common(uint16_t keycode, keyrecord_t *record) {
+ if (record->event.pressed) {
+ switch (keycode) {
+ case UNICODE_MODE_FORWARD:
+ cycle_unicode_input_mode(+1);
+ break;
+ case UNICODE_MODE_REVERSE:
+ cycle_unicode_input_mode(-1);
+ break;
+
+ case UNICODE_MODE_OSX:
+ set_unicode_input_mode(UC_OSX);
+#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_OSX)
+ static float song_osx[][2] = UNICODE_SONG_OSX;
+ PLAY_SONG(song_osx);
+#endif
+ break;
+ case UNICODE_MODE_LNX:
+ set_unicode_input_mode(UC_LNX);
+#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_LNX)
+ static float song_lnx[][2] = UNICODE_SONG_LNX;
+ PLAY_SONG(song_lnx);
+#endif
+ break;
+ case UNICODE_MODE_WIN:
+ set_unicode_input_mode(UC_WIN);
+#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_WIN)
+ static float song_win[][2] = UNICODE_SONG_WIN;
+ PLAY_SONG(song_win);
+#endif
+ break;
+ case UNICODE_MODE_BSD:
+ set_unicode_input_mode(UC_BSD);
+#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_BSD)
+ static float song_bsd[][2] = UNICODE_SONG_BSD;
+ PLAY_SONG(song_bsd);
+#endif
+ break;
+ case UNICODE_MODE_WINC:
+ set_unicode_input_mode(UC_WINC);
+#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_WINC)
+ static float song_winc[][2] = UNICODE_SONG_WINC;
+ PLAY_SONG(song_winc);
+#endif
+ break;
+ }