mirror of
https://github.com/robertkrimen/otto
synced 2025-10-26 20:28:49 +08:00
Remarks on UTF-8/16
This commit is contained in:
6
otto.go
6
otto.go
@@ -88,6 +88,7 @@ Caveat Emptor
|
||||
* Number.prototype.{toFixed,toExponential,toPrecision} are missing.
|
||||
* Does not support the (?!) or (?=) regular expression syntax (because Go does not)
|
||||
* Really, error reporting could use some improvement.
|
||||
* For now, otto handles strings as UTF-8 rather than UTF-16.
|
||||
|
||||
Regular Expression Syntax
|
||||
|
||||
@@ -97,6 +98,11 @@ Unfortunately, JavaScript has positive and negative lookahead, which is not supp
|
||||
|
||||
A brief discussion of this limitation: "Regexp (?!re)" https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/7qgSDWPIh_E
|
||||
|
||||
UTF-8 UTF-16
|
||||
|
||||
Internally, otto stores strings as Go does, which is UTF-8. JavaScript calls for strings to be handled as UTF-16.
|
||||
This leads to some strange edge cases, such as a UTF-8 string having a length of 5, while the "same" string as UTF-16 has a length of 3.
|
||||
|
||||
*/
|
||||
package otto
|
||||
|
||||
|
||||
Reference in New Issue
Block a user