2009/9/8 ryan dahl <[email protected]>: > Hello - > > I am trying to store binary in a string by using an > ExternalAsciiStringResource. There is a problem with values over 127.
You are breaking the contract by putting non-ASCII in an ASCII string. There are multiple places in the code where we assume that this is not done. What you are looking for is Blob support, which is not done: http://code.google.com/p/v8/issues/detail?id=270 If you know you always have an even number of bytes then you can use 16bit strings. This will probably work fairly well. > It seems this might be solved a some cast somewhere inside of V8? Or > is it more complicated than that? The problem is shown with the > attached C++ program. > > It seems arbitrary binary data inside a string is possible as > demonstrated by this program: > > for (var i = 0; i < 256; i++) { > var s = "'\\" + i.toString(8) + "'"; > S = eval(s); > print(s + " " + JSON.stringify(S) + " " + S.charCodeAt(0)); > if(S.charCodeAt(0) != i) throw "mismatch"; > } > > It would be nice to be able to use ExternalAsciiStringResource in this way. > > > > -- Erik Corry, Software Engineer Google Denmark ApS. CVR nr. 28 86 69 84 c/o Philip & Partners, 7 Vognmagergade, P.O. Box 2227, DK-1018 Copenhagen K, Denmark. --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
