Jump to content

UTF-8 encode and decode: Difference between revisions

m
(→‎{{header|UNIX Shell}}: Add implementation)
Line 4,265:
Dim h_0,h_2,h_3,h_4
Dim mc_0,mc_2,mc_3,mc_4
Dim mm_0
 
m_1=&h3F
Line 4,283 ⟶ 4,282:
mc_3=&hF
mc_4=&h7
 
mm_0=&h3f
 
 
Function cp2utf8(cp) 'cp as long, returns string
Line 4,334 ⟶ 4,330:
Dim c,c0,c1,c2,u
c=b(i):c0=pad(c(0),29) :c1=c(1) :c2=pad(c(2),12):u=cp2utf8(c1)
print c0 & " CP:" & pad("U+" & Hex(c1),-68) & " my utf8:" & utf8displ (u) & " should be:" & c2 & " back to CP:" & pad("U+" & Hex(utf82cp(u)),-68)& vbCrLf
End Sub
 
Line 4,354 ⟶ 4,350:
<small>
<pre>
LATIN CAPITAL LETTER A CP: U+41 my utf8: 41 should be: 41 back to CP: U+41
LATIN SMALL LETTER O WITH DIA CP: U+F6 my utf8: C3 B6 should be: C3 B6 back to CP: U+F6
CYRILLIC CAPITAL LETTER ZHE CP: U+416 my utf8: D0 96 should be: D0 96 back to CP: U+416
EURO SIGN CP: U+20AC my utf8: E2 82 AC should be: E2 82 AC back to CP: U+20AC
MUSICAL SYMBOL G CLEF CP: U+1D11E my utf8: F0 9D 84 9E should be: F0 9D 84 9E back to CP: U+1D11E
</pre>
</small>
 
=={{header|Wren}}==
The utf8_decode function was translated from the Go entry.
38

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.