OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Defines functions for translating between JavaScript strings and UTF8 strings | 6 * Defines functions for translating between JavaScript strings and UTF8 strings |
7 * stored in ArrayBuffers. There is much room for optimization in this code if | 7 * stored in ArrayBuffers. There is much room for optimization in this code if |
8 * it proves necessary. | 8 * it proves necessary. |
9 */ | 9 */ |
10 define("mojo/public/js/unicode", function() { | 10 define("mojo/public/js/unicode", function() { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 var utf8String = unescape(encodeURIComponent(str)); | 42 var utf8String = unescape(encodeURIComponent(str)); |
43 return utf8String.length; | 43 return utf8String.length; |
44 } | 44 } |
45 | 45 |
46 var exports = {}; | 46 var exports = {}; |
47 exports.decodeUtf8String = decodeUtf8String; | 47 exports.decodeUtf8String = decodeUtf8String; |
48 exports.encodeUtf8String = encodeUtf8String; | 48 exports.encodeUtf8String = encodeUtf8String; |
49 exports.utf8Length = utf8Length; | 49 exports.utf8Length = utf8Length; |
50 return exports; | 50 return exports; |
51 }); | 51 }); |
OLD | NEW |