We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 44e5ef4 commit b2063b9Copy full SHA for b2063b9
src/byte/ByteData.hx
@@ -13,8 +13,11 @@ abstract ByteData(haxe.io.UInt8Array) {
13
14
static public function ofString(s:String):ByteData {
15
var a = new Array();
16
+ // let's skip the bom here because otherwise UTF8 decoding is gonna
17
+ // mess it up
18
+ var first = StringTools.fastCodeAt(s, 0) == 239 ? 3 : 0;
19
// utf8-decode
- for( i in 0...s.length ) {
20
+ for( i in first...s.length ) {
21
var c : Int = StringTools.fastCodeAt(s,i);
22
if( c <= 0x7F )
23
a.push(c);
0 commit comments