File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -219,8 +219,6 @@ class GSM7EncodedChar extends EncodedChar {
219219
220220
221221// Represent a UCS-2 encoded character
222- // UCS-2 is of fixed length and requires 2 code units per character
223- // a UCS-2 code unit is an octet (8bits)
224222class UCS2EncodedChar extends EncodedChar {
225223 constructor ( char , graphemeSize ) {
226224 super ( char ) ;
@@ -229,16 +227,16 @@ class UCS2EncodedChar extends EncodedChar {
229227 if ( char . length === 2 ) {
230228 this . codeUnits = [ char . charCodeAt ( 0 ) , char . charCodeAt ( 1 ) ] ;
231229 } else {
232- this . codeUnits = [ 0x00 , char . charCodeAt ( 0 ) ] ;
230+ this . codeUnits = [ char . charCodeAt ( 0 ) ] ;
233231 }
234232 }
235233
236234 static codeUnitSizeInBits ( ) {
237- return 8 ; // UCS-2 code units are 8bits long
235+ return 16 ;
238236 }
239237
240238 sizeInBits ( ) {
241- return 16 * this . graphemeSize ; // UCS-2 characters are always 2 code units -> 16bits
239+ return 16 * this . raw . length ;
242240 }
243241}
244242
You can’t perform that action at this time.
0 commit comments