' convert UTF8 ASCII to unicode (BlitzMax allways use 16 byte strings) Function Unicode$(UTF8$) Local RESULT$="" Local UTF$="" Local Length=0 Local Last$="" For Local i=1 To Len(UTF8$) Local Char$=Mid$(UTF8$,i,1) Local B$=Right$(Bin$(Asc(Char$)),8) If Length>0 UTF$=UTF$+Right$(B$,6) Length:-1 If Left$(B$,2)<>"10" Length=0 RESULT$=RESULT$+Last$ Last$="" ElseIf Length=0 RESULT$=RESULT$+Chr$(Bin2Int(UTF$)) EndIf EndIf If Length=0 If Left$(B$,1)="0" Result$=Result$+Char$; Length=0 ElseIf Left$(B$,3)="110" Last$=CHAR$ UTF$=Right$(B$,5) Length=1 ElseIf Left$(B$,4)="1110" UTF$=Right$(B$,5) Length=2 ElseIf Left$(B$,4)="11110" UTF$=Right$(B$,5) Length=3 EndIf EndIf Next Return RESULT$ EndFunction Function Bin2Int:Int(Binary$) Local result=0 Local D=1 For Local i=Len(Binary$) To 1 Step -1 If Mid$(Binary$,i,1)="1" Then result=result+d D=D+D Next Return result EndFunction ' This code check a OGG formatted string (the string end with a double null). Function checkCommands$(handler:Byte Ptr) Local Value$="" Local Name$="" Local status=0 Local position=0 While handler[position]<>0 Local Line$="" status=0 Name$="" Value$="" While handler[position]<>0 Line$=Line$+Chr$(handler[position]) If status=0 If Chr$(handler[position])<>"=" Name$=Name$+Chr$(handler[position]) Else status=1 EndIf Else Value$=Value$+Chr$(handler[position]) EndIf position:+1 EndWhile Name$=Trim$(Upper$(Name$)) Name$="#"+Name$+"#" Value$=Trim$(Value$) Value$=Unicode$(Value$) Print Name$+" "+Value$ position:+1 EndWhile EndFunction