Closed mike-lischke closed 2 years ago
Apparently this is a known problem, but unfortunately not mentioned on MDN, which is why I didn't saw possible solutions until now. Here's one: https://stackoverflow.com/questions/38432611/converting-arraybuffer-to-string-maximum-call-stack-size-exceeded
Apparently there's a size limit what
String.fromCharCode
can handle and that can lead to an exception which is totally unexpected, because the given range is correct.When calling
CharStream.getText(range)
the call reaches through toCodePointCharStream.getText()
. With a large enough range the following code crashes:The numbers below show the current values passed in and the maximum number of values that
String.fromCharCode
can handle without problems (119886). One more and you get:The stream size is 140697.
I didn't see any mentioning of this problem on MDN, so I'm not sure if that is an inherent problem with JS String or has other reasons. I can certainly handle the range error, but since the given range is valid, this makes me wonder, if there shouldn't be a central solution in the code point char stream.