-function char_to_range(c) -- return the (external) range number
- if not c or c<0 or c>0x10FFFF then
- ltjb.package_error('luatexja',
- 'bad character code (' .. tostring(c) .. ')',
- {'A character number must be between 0 and 0x10ffff.',
- 'So I changed this one to zero.'})
- c=0
- elseif c<0x80 then return -1
- else
- local i = jcr_table_main[c] or 0
- if i==0 then return 217 else return i end
+function char_to_range(c) -- return the external range number
+ c=ltjb.in_unicode(c, false)
+ if c<0x80 then return -1
+ else
+ local r = jcr_table_main[c] or 217
+ return (r and r~=0) and r or 217