Japanese chars not displaying in side loaded webVTT

I have enabled WebVTT in a live application for multi language captions from onTextData. However injecting japanese chars correctly doesn’t display in the generated webVTT correctly. The label for 3 letter iso code jpn shows up as ??? on the text track. So even it cant generate the label correctly.

What is the correct way ?

VOD japanese VTT is perfectly fine.

I have a medialist that generates subtitle languages like

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",FORCED=NO,AUTOSELECT=YES,URI="subtitlelist_leng_w1412002914_b4096000.m3u8?vttlang=en,es,ja",LANGUAGE="eng"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Espa�ol",FORCED=NO,AUTOSELECT=YES,URI="subtitlelist_lspa_w1412002914_b4096000.m3u8?vttlang=en,es,ja",LANGUAGE="spa"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="???",FORCED=NO,AUTOSELECT=YES,URI="subtitlelist_ljpn_w1412002914_b4096000.m3u8?vttlang=en,es,ja",LANGUAGE="jpn"
#EXT-X-STREAM-INF:BANDWIDTH=4096000,CODECS="avc1.42001e,mp4a.40.2",RESOLUTION=1920x1080,CLOSED-CAPTIONS=NONE,SUBTITLES="subs"
chunklist_w1412002914_b4096000.m3u8?vttlang=en%2Ces%2Cja

And then the vtt looks like

00:02:59.299 --> 00:03:00.298
���� Wowza Media Server クローズドキャプション。

The text being injected is

 ? ? ?  ?  Wowza Media Server クローズドキャプション。 

like so

AMFDataObj amfData = new AMFDataObj();
			
			ByteBuffer buffer = StandardCharsets.UTF_16.encode(onTextData.text); 

			String utf8EncodedString = StandardCharsets.UTF_16.decode(buffer).toString();
			
			//Base64.Encoder encoder = Base64.getEncoder();
			//String encoded = encoder.encodeToString(utf8EncodedString.getBytes());
			
			

			getLogger().info(utf8EncodedString + " lang: " + lang);
		
			amfData.put("text", new AMFDataItem(utf8EncodedString));
			amfData.put("language", new AMFDataItem(lang));
			amfData.put("trackid", new AMFDataItem(trackNumber));							
			stream.sendDirect("onTextData", amfData);

I noticed I can send as unicode encoded strings. But is there a way to customise the subtitle chunks in the api in a module ? I can probably convert them back there.

\u00E5\u02C6\uFFFD\u00E3\u201A\uFFFD\u00E3\uFFFD\u00A6\u00E3\uFFFD\u00AE Wowza Media Server \u00E3\u201A\u00AF\u00E3\u0192\u00AD\u00E3\u0192\u00BC\u00E3\u201A\u00BA\u00E3\u0192\u2030\u00E3\u201A\u00AD\u00E3\u0192\u00A3\u00E3\u0192\u2014\u00E3\u201A\u00B7\u00E3\u0192\u00A7\u00E3\u0192\u00B3\u00E3\u20AC\u201A

Hi Daniel,

It’s been many years but when I worked on this at Wowza, I remember having unit tests for unicode subtitles in HLS streams. My memory is that there were working tests for side loaded webVTT. (I cannot remember if there were tests for live stream unicode injection via onTextData)

ScottK