Function UTF8(s$) As String
For i% = 1 To Len(s$)
u& = Uni(Mid$(s$, i%, 1))
If u& < &H80 Then
r$ = r$ & Uchr$(u&)
Elseif u& < &HC0 Then
r$ = r$ & Uchr$(&HC2) & Uchr$(u&)
Elseif u& < &H100 Then
r$ = r$ & Uchr$(&HC3) & Uchr$(u& - &H40)
Else
Error 1000, "Character is not in ISO-8859-1"
End If
Next
UTF8 = r$
End Function