File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 228228--- @param index ? integer
229229--- @return integer[]
230230function M .utf_to_byteindex (layout , encoding , index )
231- return M .conv_codeunit (layout , encoding , ' utf-8' , index )
231+ return M .get_equivalent_unit_range (layout , encoding , ' utf-8' , index )
232232end
233233
234234-- 给定 UTF-8 字符串 s,目标编码 encoding,以及在 UTF-8 编码中字节位置
@@ -240,10 +240,10 @@ end
240240--- @param index ? integer
241241--- @return integer[]
242242function M .byte_to_utfindex (layout , encoding , index )
243- return M .conv_codeunit (layout , ' utf-8' , encoding , index )
243+ return M .get_equivalent_unit_range (layout , ' utf-8' , encoding , index )
244244end
245245
246- function M .conv_codeunit (layout , from_encoding , to_encoding , index )
246+ function M .get_equivalent_unit_range (layout , from_encoding , to_encoding , index )
247247 local from_cumulative_units = layout .cumulative_units [from_encoding ]
248248 local to_cumulative_units = layout .cumulative_units [to_encoding ]
249249
You can’t perform that action at this time.
0 commit comments