nam8384 > 10-04-19, 11:47 AM
ongke0711 > 10-04-19, 12:45 PM
Option Compare Database
Option Explicit
Public Enum convert_dest
dst_uni = 1
dst_vni = 2
dst_vn3 = 3
dst_windows1258 = 4
dst_khongdau = 5
End Enum
Public Enum convert_source
src_uni = 1
src_vni = 2
src_vn3 = 3
src_windows1258 = 4
End Enum
Private Const s_khong_dau As String = "aaAAdDeEooOOuUaaaaaaaaaaaaaaaAAAAAAAAAAAAAAAeeeeeeeeeeEEEEEEEEEEiiiiiIIIIIoooooooooooooooOOOOOOOOOOOOOOOuuuuuuuuuuUUUUUUUUUUyyyyyYYYYY"
Private s_dung_san As String, s_to_hop As String, s_vni As String, s_vn3 As String, s_windows1258 As String
Private sort_dung_san As String, sort_vni As String, sort_vn3 As String
Private Sub InitVietnameseStr()
Dim k As Long, a() As Byte
Dim dungsan_bytes(), tohop_bytes(), vni_bytes(), vn3_bytes(), windows1258_bytes()
Dim sort_dungsan_bytes(), sort_vn3_bytes(), sort_vni_bytes()
If Len(s_dung_san) > 0 Then Exit Sub
dungsan_bytes = Array(226, 0, 3, 1, 194, 0, 2, 1, 17, 1, 16, 1, 234, 0, 202, 0, 161, 1, 244, 0, 160, 1, 212, 0, 176, 1, _
175, 1, 224, 0, 163, 30, 227, 0, 225, 0, 161, 30, 167, 30, 169, 30, 171, 30, 165, 30, 173, 30, _
177, 30, 179, 30, 181, 30, 175, 30, 183, 30, 192, 0, 162, 30, 195, 0, 193, 0, 160, 30, 166, 30, _
168, 30, 170, 30, 164, 30, 172, 30, 176, 30, 178, 30, 180, 30, 174, 30, 182, 30, 232, 0, 187, _
30, 189, 30, 233, 0, 185, 30, 193, 30, 195, 30, 197, 30, 191, 30, 199, 30, 200, 0, 186, 30, 188, _
30, 201, 0, 184, 30, 192, 30, 194, 30, 196, 30, 190, 30, 198, 30, 236, 0, 201, 30, 41, 1, 237, 0, _
203, 30, 204, 0, 200, 30, 40, 1, 205, 0, 202, 30, 242, 0, 207, 30, 245, 0, 243, 0, 205, 30, 221, _
30, 223, 30, 225, 30, 219, 30, 227, 30, 211, 30, 213, 30, 215, 30, 209, 30, 217, 30, 210, 0, _
206, 30, 213, 0, 211, 0, 204, 30, 220, 30, 222, 30, 224, 30, 218, 30, 226, 30, 210, 30, 212, 30, _
214, 30, 208, 30, 216, 30, 249, 0, 231, 30, 105, 1, 250, 0, 229, 30, 235, 30, 237, 30, 239, 30, _
233, 30, 241, 30, 217, 0, 230, 30, 104, 1, 218, 0, 228, 30, 234, 30, 236, 30, 238, 30, 232, 30, _
240, 30, 243, 30, 247, 30, 249, 30, 253, 0, 245, 30, 242, 30, 246, 30, 248, 30, 221, 0, 244, 30)
tohop_bytes = Array(226, 0, 3, 1, 194, 0, 2, 1, 17, 1, 16, 1, 234, 0, 202, 0, 161, 1, 244, 0, _
160, 1, 212, 0, 176, 1, 175, 1, 97, 0, 0, 3, 97, 0, 9, 3, 97, 0, 3, 3, 97, 0, 1, 3, 97, 0, 35, 3, 226, 0, _
0, 3, 226, 0, 9, 3, 226, 0, 3, 3, 226, 0, 1, 3, 226, 0, 35, 3, 3, 1, 0, 3, 3, 1, 9, 3, 3, 1, 3, 3, 3, 1, 1, 3, _
3, 1, 35, 3, 65, 0, 0, 3, 65, 0, 9, 3, 65, 0, 3, 3, 65, 0, 1, 3, 65, 0, 35, 3, 194, 0, 0, 3, 194, 0, 9, 3, 194, _
0, 3, 3, 194, 0, 1, 3, 194, 0, 35, 3, 2, 1, 0, 3, 2, 1, 9, 3, 2, 1, 3, 3, 2, 1, 1, 3, 2, 1, 35, 3, 101, 0, 0, _
3, 101, 0, 9, 3, 101, 0, 3, 3, 101, 0, 1, 3, 101, 0, 35, 3, 234, 0, 0, 3, 234, 0, 9, 3, 234, 0, 3, 3, 234, 0, _
1, 3, 234, 0, 35, 3, 69, 0, 0, 3, 69, 0, 9, 3, 69, 0, 3, 3, 69, 0, 1, 3, 69, 0, 35, 3, 202, 0, 0, 3, 202, 0, _
9, 3, 202, 0, 3, 3, 202, 0, 1, 3, 202, 0, 35, 3, 105, 0, 0, 3, 105, 0, 9, 3, 105, 0, 3, 3, 105, 0, 1, 3, _
105, 0, 35, 3, 73, 0, 0, 3, 73, 0, 9, 3, 73, 0, 3, 3, 73, 0, 1, 3, 73, 0, 35, 3, 111, 0, 0, 3, 111, 0, 9, 3, _
111, 0, 3, 3, 111, 0, 1, 3, 111, 0, 35, 3, 161, 1, 0, 3, 161, 1, 9, 3, 161, 1, 3, 3, 161, 1, 1, 3, 161, 1, _
35, 3, 244, 0, 0, 3, 244, 0, 9, 3, 244, 0, 3, 3, 244, 0, 1, 3, 244, 0, 35, 3, 79, 0, 0, 3, 79, 0, 9, 3, 79, 0, _
3, 3, 79, 0, 1, 3, 79, 0, 35, 3, 160, 1, 0, 3, 160, 1, 9, 3, 160, 1, 3, 3, 160, 1, 1, 3, 160, 1, 35, 3, 212, _
0, 0, 3, 212, 0, 9, 3, 212, 0, 3, 3, 212, 0, 1, 3, 212, 0, 35, 3, 117, 0, 0, 3, 117, 0, 9, 3, 117, 0, 3, 3, _
117, 0, 1, 3, 117, 0, 35, 3, 176, 1, 0, 3, 176, 1, 9, 3, 176, 1, 3, 3, 176, 1, 1, 3, 176, 1, 35, 3, 85, 0, _
0, 3, 85, 0, 9, 3, 85, 0, 3, 3, 85, 0, 1, 3, 85, 0, 35, 3, 175, 1, 0, 3, 175, 1, 9, 3, 175, 1, 3, 3, 175, 1, _
1, 3, 175, 1, 35, 3, 121, 0, 0, 3, 121, 0, 9, 3, 121, 0, 3, 3, 121, 0, 1, 3, 121, 0, 35, 3, 89, 0, 0, 3, 89, _
0, 9, 3, 89, 0, 3, 3, 89, 0, 1, 3, 89, 0, 35, 3)
vni_bytes = Array(97, 0, 226, 0, 97, 0, 234, 0, 65, 0, 194, 0, 65, 0, 202, 0, 241, 0, 32, 0, 209, 0, _
32, 0, 101, 0, 226, 0, 69, 0, 194, 0, 244, 0, 32, 0, 111, 0, 226, 0, 212, 0, 32, 0, 79, 0, 194, 0, _
246, 0, 32, 0, 214, 0, 32, 0, 97, 0, 248, 0, 97, 0, 251, 0, 97, 0, 245, 0, 97, 0, 249, 0, 97, 0, 239, 0, _
97, 0, 224, 0, 97, 0, 229, 0, 97, 0, 227, 0, 97, 0, 225, 0, 97, 0, 228, 0, 97, 0, 232, 0, 97, 0, 250, 0, _
97, 0, 252, 0, 97, 0, 233, 0, 97, 0, 235, 0, 65, 0, 216, 0, 65, 0, 219, 0, 65, 0, 213, 0, 65, 0, 217, 0, _
65, 0, 207, 0, 65, 0, 192, 0, 65, 0, 197, 0, 65, 0, 195, 0, 65, 0, 193, 0, 65, 0, 196, 0, 65, 0, 200, 0, _
65, 0, 218, 0, 65, 0, 220, 0, 65, 0, 201, 0, 65, 0, 203, 0, 101, 0, 248, 0, 101, 0, 251, 0, 101, 0, _
245, 0, 101, 0, 249, 0, 101, 0, 239, 0, 101, 0, 224, 0, 101, 0, 229, 0, 101, 0, 227, 0, 101, 0, _
225, 0, 101, 0, 228, 0, 69, 0, 216, 0, 69, 0, 219, 0, 69, 0, 213, 0, 69, 0, 217, 0, 69, 0, 207, 0, _
69, 0, 192, 0, 69, 0, 197, 0, 69, 0, 195, 0, 69, 0, 193, 0, 69, 0, 196, 0, 236, 0, 32, 0, 230, 0, _
32, 0, 243, 0, 32, 0, 237, 0, 32, 0, 242, 0, 32, 0, 204, 0, 32, 0, 198, 0, 32, 0, 211, 0, 32, 0, 205, 0, _
32, 0, 210, 0, 32, 0, 111, 0, 248, 0, 111, 0, 251, 0, 111, 0, 245, 0, 111, 0, 249, 0, 111, 0, 239, 0, _
244, 0, 248, 0, 244, 0, 251, 0, 244, 0, 245, 0, 244, 0, 249, 0, 244, 0, 239, 0, 111, 0, 224, 0, _
111, 0, 229, 0, 111, 0, 227, 0, 111, 0, 225, 0, 111, 0, 228, 0, 79, 0, 216, 0, 79, 0, 219, 0, 79, 0, _
213, 0, 79, 0, 217, 0, 79, 0, 207, 0, 212, 0, 216, 0, 212, 0, 219, 0, 212, 0, 213, 0, 212, 0, 217, 0, _
212, 0, 207, 0, 79, 0, 192, 0, 79, 0, 197, 0, 79, 0, 195, 0, 79, 0, 193, 0, 79, 0, 196, 0, 117, 0, _
248, 0, 117, 0, 251, 0, 117, 0, 245, 0, 117, 0, 249, 0, 117, 0, 239, 0, 246, 0, 248, 0, 246, 0, _
251, 0, 246, 0, 245, 0, 246, 0, 249, 0, 246, 0, 239, 0, 85, 0, 216, 0, 85, 0, 219, 0, 85, 0, 213, 0, _
85, 0, 217, 0, 85, 0, 207, 0, 214, 0, 216, 0, 214, 0, 219, 0, 214, 0, 213, 0, 214, 0, 217, 0, 214, 0, _
207, 0, 121, 0, 248, 0, 121, 0, 251, 0, 121, 0, 245, 0, 121, 0, 249, 0, 238, 0, 32, 0, 89, 0, 216, 0, _
89, 0, 219, 0, 89, 0, 213, 0, 89, 0, 217, 0, 244, 30, 32, 0)
vn3_bytes = Array(169, 0, 168, 0, 162, 0, 161, 0, 174, 0, 167, 0, 170, 0, 163, 0, 172, 0, 171, 0, _
165, 0, 164, 0, 173, 0, 166, 0, 181, 0, 182, 0, 183, 0, 184, 0, 185, 0, 199, 0, 200, 0, 201, 0, _
202, 0, 203, 0, 187, 0, 188, 0, 189, 0, 190, 0, 198, 0, 181, 0, 182, 0, 183, 0, 184, 0, 185, 0, _
199, 0, 200, 0, 201, 0, 202, 0, 203, 0, 187, 0, 188, 0, 189, 0, 190, 0, 198, 0, 204, 0, 206, 0, _
207, 0, 208, 0, 209, 0, 210, 0, 211, 0, 212, 0, 213, 0, 214, 0, 204, 0, 206, 0, 207, 0, 208, 0, _
209, 0, 210, 0, 211, 0, 212, 0, 213, 0, 214, 0, 215, 0, 216, 0, 220, 0, 221, 0, 222, 0, 215, 0, _
216, 0, 220, 0, 221, 0, 222, 0, 223, 0, 225, 0, 226, 0, 227, 0, 228, 0, 234, 0, 235, 0, 236, 0, _
237, 0, 238, 0, 229, 0, 230, 0, 231, 0, 232, 0, 233, 0, 223, 0, 225, 0, 226, 0, 227, 0, 228, 0, _
234, 0, 235, 0, 236, 0, 237, 0, 238, 0, 229, 0, 230, 0, 231, 0, 232, 0, 233, 0, 239, 0, 241, 0, _
242, 0, 243, 0, 244, 0, 245, 0, 246, 0, 247, 0, 248, 0, 249, 0, 239, 0, 241, 0, 242, 0, 243, 0, _
244, 0, 245, 0, 246, 0, 247, 0, 248, 0, 249, 0, 250, 0, 251, 0, 252, 0, 253, 0, 254, 0, 250, 0, _
251, 0, 252, 0, 253, 0, 244, 30)
windows1258_bytes = Array(226, 0, 32, 0, 3, 1, 32, 0, 194, 0, 32, 0, 2, 1, 32, 0, 17, 1, 32, 0, 16, 1, 32, 0, 25, 1, 32, 0, 24, 1, 32, 0, 81, 1, 32, 0, 244, 0, 32, 0, _
80, 1, 32, 0, 212, 0, 32, 0, 253, 0, 32, 0, 221, 0, 32, 0, 97, 0, 26, 1, 97, 0, 71, 1, 97, 0, 98, 1, 97, 0, 27, 1, 97, 0, 72, 1, 226, 0, 26, 1, 226, 0, 71, 1, 226, 0, _
98, 1, 226, 0, 27, 1, 226, 0, 72, 1, 3, 1, 26, 1, 3, 1, 71, 1, 3, 1, 98, 1, 3, 1, 27, 1, 3, 1, 72, 1, 65, 0, 26, 1, 65, 0, 71, 1, 65, 0, 98, 1, 65, 0, 27, 1, 65, 0, 72, 1, _
194, 0, 26, 1, 194, 0, 71, 1, 194, 0, 98, 1, 194, 0, 27, 1, 194, 0, 72, 1, 2, 1, 26, 1, 2, 1, 71, 1, 2, 1, 98, 1, 2, 1, 27, 1, 2, 1, 72, 1, 101, 0, 26, 1, 101, 0, 71, 1, _
101, 0, 98, 1, 101, 0, 27, 1, 101, 0, 72, 1, 25, 1, 26, 1, 25, 1, 71, 1, 25, 1, 98, 1, 25, 1, 27, 1, 25, 1, 72, 1, 69, 0, 26, 1, 69, 0, 71, 1, 69, 0, 98, 1, 69, 0, 27, 1, _
69, 0, 72, 1, 24, 1, 26, 1, 24, 1, 71, 1, 24, 1, 98, 1, 24, 1, 27, 1, 24, 1, 72, 1, 105, 0, 26, 1, 105, 0, 71, 1, 105, 0, 98, 1, 105, 0, 27, 1, 105, 0, 72, 1, 73, 0, 26, _
1, 73, 0, 71, 1, 73, 0, 98, 1, 73, 0, 27, 1, 73, 0, 72, 1, 111, 0, 26, 1, 111, 0, 71, 1, 111, 0, 98, 1, 111, 0, 27, 1, 111, 0, 72, 1, 81, 1, 26, 1, 81, 1, 71, 1, 81, 1, _
98, 1, 81, 1, 27, 1, 81, 1, 72, 1, 244, 0, 26, 1, 244, 0, 71, 1, 244, 0, 98, 1, 244, 0, 27, 1, 244, 0, 72, 1, 79, 0, 26, 1, 79, 0, 71, 1, 79, 0, 98, 1, 79, 0, 27, 1, _
79, 0, 72, 1, 80, 1, 26, 1, 80, 1, 71, 1, 80, 1, 98, 1, 80, 1, 27, 1, 80, 1, 72, 1, 212, 0, 26, 1, 212, 0, 71, 1, 212, 0, 98, 1, 212, 0, 27, 1, 212, 0, 72, 1, 117, 0, _
26, 1, 117, 0, 71, 1, 117, 0, 98, 1, 117, 0, 27, 1, 117, 0, 72, 1, 253, 0, 26, 1, 253, 0, 71, 1, 253, 0, 98, 1, 253, 0, 27, 1, 253, 0, 72, 1, 85, 0, 26, 1, 85, 0, _
71, 1, 85, 0, 98, 1, 85, 0, 27, 1, 85, 0, 72, 1, 221, 0, 26, 1, 221, 0, 71, 1, 221, 0, 98, 1, 221, 0, 27, 1, 221, 0, 72, 1, 121, 0, 26, 1, 121, 0, 71, 1, 121, 0, 98, 1, _
121, 0, 27, 1, 121, 0, 72, 1, 89, 0, 26, 1, 89, 0, 71, 1, 89, 0, 98, 1, 89, 0, 27, 1, 89, 0, 72, 1)
sort_dungsan_bytes = Array(48, 0, 49, 0, 50, 0, 51, 0, 52, 0, 53, 0, 54, 0, 55, 0, 56, 0, 57, 0, _
58, 0, 59, 0, 60, 0, 61, 0, 62, 0, 63, 0, 64, 0, 91, 0, 92, 0, 93, 0, 94, 0, 95, 0, 123, 0, 124, 0, _
125, 0, 126, 0, 97, 0, 224, 0, 163, 30, 227, 0, 225, 0, 161, 30, 3, 1, 177, 30, 179, 30, 181, 30, _
175, 30, 183, 30, 226, 0, 167, 30, 169, 30, 171, 30, 165, 30, 173, 30, 98, 0, 99, 0, 100, 0, 17, 1, _
101, 0, 232, 0, 187, 30, 189, 30, 233, 0, 185, 30, 234, 0, 193, 30, 195, 30, 197, 30, 191, 30, _
199, 30, 102, 0, 103, 0, 104, 0, 105, 0, 236, 0, 201, 30, 41, 1, 237, 0, 203, 30, 106, 0, 107, 0, _
108, 0, 109, 0, 110, 0, 111, 0, 242, 0, 207, 30, 245, 0, 243, 0, 205, 30, 244, 0, 211, 30, 213, _
30, 215, 30, 209, 30, 217, 30, 161, 1, 221, 30, 223, 30, 225, 30, 219, 30, 227, 30, 112, 0, 113, _
0, 114, 0, 115, 0, 116, 0, 117, 0, 249, 0, 231, 30, 105, 1, 250, 0, 229, 30, 176, 1, 235, 30, 237, _
30, 239, 30, 233, 30, 241, 30, 118, 0, 119, 0, 120, 0, 121, 0, 243, 30, 247, 30, 249, 30, 253, 0, _
245, 30, 122, 0, 65, 0, 192, 0, 162, 30, 195, 0, 193, 0, 160, 30, 2, 1, 176, 30, 178, 30, 180, 30, _
174, 30, 182, 30, 194, 0, 166, 30, 168, 30, 170, 30, 164, 30, 172, 30, 66, 0, 67, 0, 68, 0, 16, 1, _
69, 0, 200, 0, 186, 30, 188, 30, 201, 0, 184, 30, 202, 0, 192, 30, 194, 30, 196, 30, 190, 30, 198, _
30, 70, 0, 71, 0, 72, 0, 73, 0, 204, 0, 200, 30, 40, 1, 205, 0, 202, 30, 74, 0, 75, 0, 76, 0, 77, 0, 78, _
0, 79, 0, 210, 0, 206, 30, 213, 0, 211, 0, 204, 30, 212, 0, 210, 30, 212, 30, 214, 30, 208, 30, _
216, 30, 160, 1, 220, 30, 222, 30, 224, 30, 218, 30, 226, 30, 80, 0, 81, 0, 82, 0, 83, 0, 84, 0, 85, _
0, 217, 0, 230, 30, 104, 1, 218, 0, 228, 30, 175, 1, 234, 30, 236, 30, 238, 30, 232, 30, 240, 30, _
86, 0, 87, 0, 88, 0, 89, 0, 242, 30, 246, 30, 248, 30, 221, 0, 244, 30, 90, 0)
sort_vn3_bytes = Array(48, 0, 49, 0, 50, 0, 51, 0, 52, 0, 53, 0, 54, 0, 55, 0, 56, 0, 57, 0, 58, 0, 59, _
0, 60, 0, 61, 0, 62, 0, 63, 0, 64, 0, 91, 0, 92, 0, 93, 0, 94, 0, 95, 0, 123, 0, 124, 0, 125, 0, 126, 0, _
97, 0, 181, 0, 182, 0, 183, 0, 184, 0, 185, 0, 168, 0, 187, 0, 188, 0, 189, 0, 190, 0, 198, 0, 169, _
0, 199, 0, 200, 0, 201, 0, 202, 0, 203, 0, 98, 0, 99, 0, 100, 0, 174, 0, 101, 0, 204, 0, 206, 0, 207, _
0, 208, 0, 209, 0, 170, 0, 210, 0, 211, 0, 212, 0, 213, 0, 214, 0, 102, 0, 103, 0, 104, 0, 105, 0, _
215, 0, 216, 0, 220, 0, 221, 0, 222, 0, 106, 0, 107, 0, 108, 0, 109, 0, 110, 0, 111, 0, 223, 0, 225, _
0, 226, 0, 227, 0, 228, 0, 171, 0, 229, 0, 230, 0, 231, 0, 232, 0, 233, 0, 172, 0, 234, 0, 235, 0, _
236, 0, 237, 0, 238, 0, 112, 0, 113, 0, 114, 0, 115, 0, 116, 0, 117, 0, 239, 0, 241, 0, 242, 0, 243, _
0, 244, 0, 173, 0, 245, 0, 246, 0, 247, 0, 248, 0, 249, 0, 118, 0, 119, 0, 120, 0, 121, 0, 250, 0, _
251, 0, 252, 0, 253, 0, 254, 0, 122, 0, 65, 0, 181, 0, 182, 0, 183, 0, 184, 0, 185, 0, 161, 0, 187, _
0, 188, 0, 189, 0, 190, 0, 198, 0, 162, 0, 199, 0, 200, 0, 201, 0, 202, 0, 203, 0, 66, 0, 67, 0, 68, _
0, 167, 0, 69, 0, 204, 0, 206, 0, 207, 0, 208, 0, 209, 0, 163, 0, 210, 0, 211, 0, 212, 0, 213, 0, 214, _
0, 70, 0, 71, 0, 72, 0, 73, 0, 215, 0, 216, 0, 220, 0, 221, 0, 222, 0, 74, 0, 75, 0, 76, 0, 77, 0, 78, 0, _
79, 0, 223, 0, 225, 0, 226, 0, 227, 0, 228, 0, 164, 0, 229, 0, 230, 0, 231, 0, 232, 0, 233, 0, 165, _
0, 234, 0, 235, 0, 236, 0, 237, 0, 238, 0, 80, 0, 81, 0, 82, 0, 83, 0, 84, 0, 85, 0, 239, 0, 241, 0, _
242, 0, 243, 0, 244, 0, 166, 0, 245, 0, 246, 0, 247, 0, 248, 0, 249, 0, 86, 0, 87, 0, 88, 0, 89, 0, _
250, 0, 251, 0, 252, 0, 253, 0, 254, 0, 90, 0)
sort_vni_bytes = Array(48, 0, 32, 0, 49, 0, 32, 0, 50, 0, 32, 0, 51, 0, 32, 0, 52, 0, 32, 0, 53, 0, 32, 0, 54, 0, 32, 0, 55, 0, 32, 0, 56, 0, 32, 0, 57, 0, 32, 0, 58, 0, 32, 0, 59, 0, 32, 0, 60, 0, 32, 0, 61, 0, _
32, 0, 62, 0, 32, 0, 63, 0, 32, 0, 64, 0, 32, 0, 91, 0, 32, 0, 92, 0, 32, 0, 93, 0, 32, 0, 94, 0, 32, 0, 95, 0, 32, 0, 123, 0, 32, 0, 124, 0, 32, 0, 125, 0, 32, 0, 126, 0, 32, 0, 97, 0, 32, 0, 97, 0, 248, 0, 97, _
0, 251, 0, 97, 0, 245, 0, 97, 0, 249, 0, 97, 0, 239, 0, 97, 0, 234, 0, 97, 0, 232, 0, 97, 0, 250, 0, 97, 0, 252, 0, 97, 0, 233, 0, 97, 0, 235, 0, 97, 0, 226, 0, 97, 0, 224, 0, 97, 0, 229, 0, 97, 0, 227, 0, _
97, 0, 225, 0, 97, 0, 228, 0, 98, 0, 32, 0, 99, 0, 32, 0, 100, 0, 32, 0, 241, 0, 32, 0, 101, 0, 32, 0, 101, 0, 248, 0, 101, 0, 251, 0, 101, 0, 245, 0, 101, 0, 249, 0, 101, 0, 239, 0, 101, 0, 226, 0, 101, _
0, 224, 0, 101, 0, 229, 0, 101, 0, 227, 0, 101, 0, 225, 0, 101, 0, 228, 0, 102, 0, 32, 0, 103, 0, 32, 0, 104, 0, 32, 0, 105, 0, 32, 0, 236, 0, 32, 0, 230, 0, 32, 0, 243, 0, 32, 0, 237, 0, 32, 0, 242, 0, _
32, 0, 106, 0, 32, 0, 107, 0, 32, 0, 108, 0, 32, 0, 109, 0, 32, 0, 110, 0, 32, 0, 111, 0, 32, 0, 111, 0, 248, 0, 111, 0, 251, 0, 111, 0, 245, 0, 111, 0, 249, 0, 111, 0, 239, 0, 111, 0, 226, 0, 111, 0, _
224, 0, 111, 0, 229, 0, 111, 0, 227, 0, 111, 0, 225, 0, 111, 0, 228, 0, 244, 0, 32, 0, 244, 0, 248, 0, 244, 0, 251, 0, 244, 0, 245, 0, 244, 0, 249, 0, 244, 0, 239, 0, 112, 0, 32, 0, 113, 0, 32, 0, 114, _
0, 32, 0, 115, 0, 32, 0, 116, 0, 32, 0, 117, 0, 32, 0, 117, 0, 248, 0, 117, 0, 251, 0, 117, 0, 245, 0, 117, 0, 249, 0, 117, 0, 239, 0, 246, 0, 32, 0, 246, 0, 248, 0, 246, 0, 251, 0, 246, 0, 245, 0, 246, _
0, 249, 0, 246, 0, 239, 0, 118, 0, 32, 0, 119, 0, 32, 0, 120, 0, 32, 0, 121, 0, 32, 0, 121, 0, 248, 0, 121, 0, 251, 0, 121, 0, 245, 0, 121, 0, 249, 0, 238, 0, 32, 0, 122, 0, 32, 0, 65, 0, 32, 0, 65, 0, 216, _
0, 65, 0, 219, 0, 65, 0, 213, 0, 65, 0, 217, 0, 65, 0, 207, 0, 65, 0, 202, 0, 65, 0, 200, 0, 65, 0, 218, 0, 65, 0, 220, 0, 65, 0, 201, 0, 65, 0, 203, 0, 65, 0, 194, 0, 65, 0, 192, 0, 65, 0, 197, 0, 65, 0, 195, _
0, 65, 0, 193, 0, 65, 0, 196, 0, 66, 0, 32, 0, 67, 0, 32, 0, 68, 0, 32, 0, 209, 0, 32, 0, 69, 0, 32, 0, 69, 0, 216, 0, 69, 0, 219, 0, 69, 0, 213, 0, 69, 0, 217, 0, 69, 0, 207, 0, 69, 0, 194, 0, 69, 0, 192, 0, _
69, 0, 197, 0, 69, 0, 195, 0, 69, 0, 193, 0, 69, 0, 196, 0, 70, 0, 32, 0, 71, 0, 32, 0, 72, 0, 32, 0, 73, 0, 32, 0, 204, 0, 32, 0, 198, 0, 32, 0, 211, 0, 32, 0, 205, 0, 32, 0, 210, 0, 32, 0, 74, 0, 32, 0, 75, 0, _
32, 0, 76, 0, 32, 0, 77, 0, 32, 0, 78, 0, 32, 0, 79, 0, 32, 0, 79, 0, 216, 0, 79, 0, 219, 0, 79, 0, 213, 0, 79, 0, 217, 0, 79, 0, 207, 0, 79, 0, 194, 0, 79, 0, 192, 0, 79, 0, 197, 0, 79, 0, 195, 0, 79, 0, 193, _
0, 79, 0, 196, 0, 212, 0, 32, 0, 212, 0, 216, 0, 212, 0, 219, 0, 212, 0, 213, 0, 212, 0, 217, 0, 212, 0, 207, 0, 80, 0, 32, 0, 81, 0, 32, 0, 82, 0, 32, 0, 83, 0, 32, 0, 84, 0, 32, 0, 85, 0, 32, 0, 85, 0, 216, _
0, 85, 0, 219, 0, 85, 0, 213, 0, 85, 0, 217, 0, 85, 0, 207, 0, 214, 0, 32, 0, 214, 0, 216, 0, 214, 0, 219, 0, 214, 0, 213, 0, 214, 0, 217, 0, 214, 0, 207, 0, 86, 0, 32, 0, 87, 0, 32, 0, 88, 0, 32, 0, 89, 0, _
32, 0, 89, 0, 216, 0, 89, 0, 219, 0, 89, 0, 213, 0, 89, 0, 217, 0, 206, 0, 32, 0, 90, 0, 32, 0)
ReDim a(268)
For k = 0 To 267
a(k) = dungsan_bytes(k)
Next k
s_dung_san = a
For k = 0 To 267
a(k) = vn3_bytes(k)
Next k
s_vn3 = a
ReDim a(508)
For k = 0 To 507
a(k) = tohop_bytes(k)
Next k
s_to_hop = a
ReDim a(536)
For k = 0 To 535
a(k) = vni_bytes(k)
Next k
s_vni = a
For k = 0 To 535
a(k) = windows1258_bytes(k)
Next k
s_windows1258 = a
ReDim a(424)
For k = 0 To 423
a(k) = sort_dungsan_bytes(k)
Next k
sort_dung_san = a
For k = 0 To 423
a(k) = sort_vn3_bytes(k)
Next k
sort_vn3 = a
ReDim a(848)
For k = 0 To 847
a(k) = sort_vni_bytes(k)
Next k
sort_vni = a
Erase a, dungsan_bytes, tohop_bytes, vni_bytes, vn3_bytes, sort_dungsan_bytes, sort_vn3_bytes, sort_vni_bytes
End Sub
Public Function SourceToDest(ByVal text As String, source As convert_source, dest As convert_dest) As String
Dim s As String, temp As String, kytu2 As String
Dim n As Long, index As Long, k As Long
Dim nr As Long
If source = dest And source <> src_uni Then
SourceToDest = text
Exit Function
End If
InitVietnameseStr
text = text & " "
s = ""
n = 1
k = Len(text)
While n < k
nr = 0
Select Case source
Case src_uni, src_vni, src_windows1258:
kytu2 = Mid(text, n, 2)
If source = src_uni Then
index = InStr(1, s_to_hop, kytu2)
If index > 14 Then
nr = (index + 15) \ 2
n = n + 2
End If
If nr = 0 Then
kytu2 = Mid(kytu2, 1, 1)
nr = InStr(1, s_dung_san, kytu2)
n = n + 1
End If
Else
If source = src_vni Then
temp = s_vni
Else
temp = s_windows1258
End If
index = InStr(1, temp, kytu2)
If index Mod 2 = 1 Then
nr = (index + 1) \ 2
n = n + 2
End If
If nr = 0 Then
kytu2 = Mid(kytu2, 1, 1)
index = InStr(1, temp, kytu2 & " ")
If index > 0 Then nr = (index + 1) \ 2
n = n + 1
End If
End If
Case Else
kytu2 = Mid(text, n, 1)
index = InStr(1, s_vn3, kytu2)
If index > 0 Then nr = index
n = n + 1
End Select
If nr > 0 Then
Select Case dest
Case dst_uni: kytu2 = Mid(s_dung_san, nr, 1)
Case dst_vni: kytu2 = Trim(Mid(s_vni, 2 * nr - 1, 2))
Case dst_vn3: kytu2 = Mid(s_vn3, nr, 1)
Case dst_windows1258: kytu2 = Trim(Mid(s_windows1258, 2 * nr - 1, 2))
Case dst_khongdau: kytu2 = Mid(s_khong_dau, nr, 1)
End Select
End If
s = s & kytu2
Wend
SourceToDest = s
End Function
Sub convUni()
[/font][/size]
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("Select * From tblTest")
rs.MoveFirst
Do Until rs.EOF
rs.Edit
rs!Hoten = SourceToDest(rs!Hoten, 1, 1)
rs.Update
rs.MoveNext
Loop
[size=medium][font=Georgia]End Sub
nam8384 > 11-04-19, 11:11 AM
(10-04-19, 12:45 PM)ongke0711 Đã viết: Tại sao bạn không đổi từ tổ hợp sang dựng sẳn vậy?
Unicode dựng sẳn nó phổ biến và tiện hơn tổ hợp chứ. Tổ hợp nó chiếm 2 ký (1 cho dấu + 1 cho ký tự) trong khi dựng sẳn chỉ là 1 ký tự dựng sẳn. Việc sắp xếp tiếng Việt theo mã dựng sẳn nó dễ hơn nhiều so với sắp xếp bằng mã tổ hợp.
Unicode tổ hợp nó là mặc định của Window, còn của bộ gõ tiếng Việt thì mặc định là dựng sẳn. Bạn nên tắt của windows.
Để chuyển từ Unicode tổ hợp sang dựng sẳn thì dùng cái hàm dứoi đây. Sau khi người dùng nhập liệu xong các textbox dạng chuỗi thì gọi hàm chuyển đổi text xong rồi mới lưu vào table.
- Copy đoạn code này vào module, đặt tên tuỳ ý.
- Ở sự kiện textbox_AfterUpdate thì gọi hàm:
Me.Textbox2.Text = SourceToDest (Me.Textbox1.Text, 1,1)
Mã PHP:Option Compare Database
Option Explicit
Public Enum convert_dest
dst_uni = 1
dst_vni = 2
dst_vn3 = 3
dst_windows1258 = 4
dst_khongdau = 5
End Enum
Public Enum convert_source
src_uni = 1
src_vni = 2
src_vn3 = 3
src_windows1258 = 4
End Enum
Private Const s_khong_dau As String = "aaAAdDeEooOOuUaaaaaaaaaaaaaaaAAAAAAAAAAAAAAAeeeeeeeeeeEEEEEEEEEEiiiiiIIIIIoooooooooooooooOOOOOOOOOOOOOOOuuuuuuuuuuUUUUUUUUUUyyyyyYYYYY"
Private s_dung_san As String, s_to_hop As String, s_vni As String, s_vn3 As String, s_windows1258 As String
Private sort_dung_san As String, sort_vni As String, sort_vn3 As String
Private Sub InitVietnameseStr()
Dim k As Long, a() As Byte
Dim dungsan_bytes(), tohop_bytes(), vni_bytes(), vn3_bytes(), windows1258_bytes()
Dim sort_dungsan_bytes(), sort_vn3_bytes(), sort_vni_bytes()
If Len(s_dung_san) > 0 Then Exit Sub
dungsan_bytes = Array(226, 0, 3, 1, 194, 0, 2, 1, 17, 1, 16, 1, 234, 0, 202, 0, 161, 1, 244, 0, 160, 1, 212, 0, 176, 1, _
175, 1, 224, 0, 163, 30, 227, 0, 225, 0, 161, 30, 167, 30, 169, 30, 171, 30, 165, 30, 173, 30, _
177, 30, 179, 30, 181, 30, 175, 30, 183, 30, 192, 0, 162, 30, 195, 0, 193, 0, 160, 30, 166, 30, _
168, 30, 170, 30, 164, 30, 172, 30, 176, 30, 178, 30, 180, 30, 174, 30, 182, 30, 232, 0, 187, _
30, 189, 30, 233, 0, 185, 30, 193, 30, 195, 30, 197, 30, 191, 30, 199, 30, 200, 0, 186, 30, 188, _
30, 201, 0, 184, 30, 192, 30, 194, 30, 196, 30, 190, 30, 198, 30, 236, 0, 201, 30, 41, 1, 237, 0, _
203, 30, 204, 0, 200, 30, 40, 1, 205, 0, 202, 30, 242, 0, 207, 30, 245, 0, 243, 0, 205, 30, 221, _
30, 223, 30, 225, 30, 219, 30, 227, 30, 211, 30, 213, 30, 215, 30, 209, 30, 217, 30, 210, 0, _
206, 30, 213, 0, 211, 0, 204, 30, 220, 30, 222, 30, 224, 30, 218, 30, 226, 30, 210, 30, 212, 30, _
214, 30, 208, 30, 216, 30, 249, 0, 231, 30, 105, 1, 250, 0, 229, 30, 235, 30, 237, 30, 239, 30, _
233, 30, 241, 30, 217, 0, 230, 30, 104, 1, 218, 0, 228, 30, 234, 30, 236, 30, 238, 30, 232, 30, _
240, 30, 243, 30, 247, 30, 249, 30, 253, 0, 245, 30, 242, 30, 246, 30, 248, 30, 221, 0, 244, 30)
tohop_bytes = Array(226, 0, 3, 1, 194, 0, 2, 1, 17, 1, 16, 1, 234, 0, 202, 0, 161, 1, 244, 0, _
160, 1, 212, 0, 176, 1, 175, 1, 97, 0, 0, 3, 97, 0, 9, 3, 97, 0, 3, 3, 97, 0, 1, 3, 97, 0, 35, 3, 226, 0, _
0, 3, 226, 0, 9, 3, 226, 0, 3, 3, 226, 0, 1, 3, 226, 0, 35, 3, 3, 1, 0, 3, 3, 1, 9, 3, 3, 1, 3, 3, 3, 1, 1, 3, _
3, 1, 35, 3, 65, 0, 0, 3, 65, 0, 9, 3, 65, 0, 3, 3, 65, 0, 1, 3, 65, 0, 35, 3, 194, 0, 0, 3, 194, 0, 9, 3, 194, _
0, 3, 3, 194, 0, 1, 3, 194, 0, 35, 3, 2, 1, 0, 3, 2, 1, 9, 3, 2, 1, 3, 3, 2, 1, 1, 3, 2, 1, 35, 3, 101, 0, 0, _
3, 101, 0, 9, 3, 101, 0, 3, 3, 101, 0, 1, 3, 101, 0, 35, 3, 234, 0, 0, 3, 234, 0, 9, 3, 234, 0, 3, 3, 234, 0, _
1, 3, 234, 0, 35, 3, 69, 0, 0, 3, 69, 0, 9, 3, 69, 0, 3, 3, 69, 0, 1, 3, 69, 0, 35, 3, 202, 0, 0, 3, 202, 0, _
9, 3, 202, 0, 3, 3, 202, 0, 1, 3, 202, 0, 35, 3, 105, 0, 0, 3, 105, 0, 9, 3, 105, 0, 3, 3, 105, 0, 1, 3, _
105, 0, 35, 3, 73, 0, 0, 3, 73, 0, 9, 3, 73, 0, 3, 3, 73, 0, 1, 3, 73, 0, 35, 3, 111, 0, 0, 3, 111, 0, 9, 3, _
111, 0, 3, 3, 111, 0, 1, 3, 111, 0, 35, 3, 161, 1, 0, 3, 161, 1, 9, 3, 161, 1, 3, 3, 161, 1, 1, 3, 161, 1, _
35, 3, 244, 0, 0, 3, 244, 0, 9, 3, 244, 0, 3, 3, 244, 0, 1, 3, 244, 0, 35, 3, 79, 0, 0, 3, 79, 0, 9, 3, 79, 0, _
3, 3, 79, 0, 1, 3, 79, 0, 35, 3, 160, 1, 0, 3, 160, 1, 9, 3, 160, 1, 3, 3, 160, 1, 1, 3, 160, 1, 35, 3, 212, _
0, 0, 3, 212, 0, 9, 3, 212, 0, 3, 3, 212, 0, 1, 3, 212, 0, 35, 3, 117, 0, 0, 3, 117, 0, 9, 3, 117, 0, 3, 3, _
117, 0, 1, 3, 117, 0, 35, 3, 176, 1, 0, 3, 176, 1, 9, 3, 176, 1, 3, 3, 176, 1, 1, 3, 176, 1, 35, 3, 85, 0, _
0, 3, 85, 0, 9, 3, 85, 0, 3, 3, 85, 0, 1, 3, 85, 0, 35, 3, 175, 1, 0, 3, 175, 1, 9, 3, 175, 1, 3, 3, 175, 1, _
1, 3, 175, 1, 35, 3, 121, 0, 0, 3, 121, 0, 9, 3, 121, 0, 3, 3, 121, 0, 1, 3, 121, 0, 35, 3, 89, 0, 0, 3, 89, _
0, 9, 3, 89, 0, 3, 3, 89, 0, 1, 3, 89, 0, 35, 3)
vni_bytes = Array(97, 0, 226, 0, 97, 0, 234, 0, 65, 0, 194, 0, 65, 0, 202, 0, 241, 0, 32, 0, 209, 0, _
32, 0, 101, 0, 226, 0, 69, 0, 194, 0, 244, 0, 32, 0, 111, 0, 226, 0, 212, 0, 32, 0, 79, 0, 194, 0, _
246, 0, 32, 0, 214, 0, 32, 0, 97, 0, 248, 0, 97, 0, 251, 0, 97, 0, 245, 0, 97, 0, 249, 0, 97, 0, 239, 0, _
97, 0, 224, 0, 97, 0, 229, 0, 97, 0, 227, 0, 97, 0, 225, 0, 97, 0, 228, 0, 97, 0, 232, 0, 97, 0, 250, 0, _
97, 0, 252, 0, 97, 0, 233, 0, 97, 0, 235, 0, 65, 0, 216, 0, 65, 0, 219, 0, 65, 0, 213, 0, 65, 0, 217, 0, _
65, 0, 207, 0, 65, 0, 192, 0, 65, 0, 197, 0, 65, 0, 195, 0, 65, 0, 193, 0, 65, 0, 196, 0, 65, 0, 200, 0, _
65, 0, 218, 0, 65, 0, 220, 0, 65, 0, 201, 0, 65, 0, 203, 0, 101, 0, 248, 0, 101, 0, 251, 0, 101, 0, _
245, 0, 101, 0, 249, 0, 101, 0, 239, 0, 101, 0, 224, 0, 101, 0, 229, 0, 101, 0, 227, 0, 101, 0, _
225, 0, 101, 0, 228, 0, 69, 0, 216, 0, 69, 0, 219, 0, 69, 0, 213, 0, 69, 0, 217, 0, 69, 0, 207, 0, _
69, 0, 192, 0, 69, 0, 197, 0, 69, 0, 195, 0, 69, 0, 193, 0, 69, 0, 196, 0, 236, 0, 32, 0, 230, 0, _
32, 0, 243, 0, 32, 0, 237, 0, 32, 0, 242, 0, 32, 0, 204, 0, 32, 0, 198, 0, 32, 0, 211, 0, 32, 0, 205, 0, _
32, 0, 210, 0, 32, 0, 111, 0, 248, 0, 111, 0, 251, 0, 111, 0, 245, 0, 111, 0, 249, 0, 111, 0, 239, 0, _
244, 0, 248, 0, 244, 0, 251, 0, 244, 0, 245, 0, 244, 0, 249, 0, 244, 0, 239, 0, 111, 0, 224, 0, _
111, 0, 229, 0, 111, 0, 227, 0, 111, 0, 225, 0, 111, 0, 228, 0, 79, 0, 216, 0, 79, 0, 219, 0, 79, 0, _
213, 0, 79, 0, 217, 0, 79, 0, 207, 0, 212, 0, 216, 0, 212, 0, 219, 0, 212, 0, 213, 0, 212, 0, 217, 0, _
212, 0, 207, 0, 79, 0, 192, 0, 79, 0, 197, 0, 79, 0, 195, 0, 79, 0, 193, 0, 79, 0, 196, 0, 117, 0, _
248, 0, 117, 0, 251, 0, 117, 0, 245, 0, 117, 0, 249, 0, 117, 0, 239, 0, 246, 0, 248, 0, 246, 0, _
251, 0, 246, 0, 245, 0, 246, 0, 249, 0, 246, 0, 239, 0, 85, 0, 216, 0, 85, 0, 219, 0, 85, 0, 213, 0, _
85, 0, 217, 0, 85, 0, 207, 0, 214, 0, 216, 0, 214, 0, 219, 0, 214, 0, 213, 0, 214, 0, 217, 0, 214, 0, _
207, 0, 121, 0, 248, 0, 121, 0, 251, 0, 121, 0, 245, 0, 121, 0, 249, 0, 238, 0, 32, 0, 89, 0, 216, 0, _
89, 0, 219, 0, 89, 0, 213, 0, 89, 0, 217, 0, 244, 30, 32, 0)
vn3_bytes = Array(169, 0, 168, 0, 162, 0, 161, 0, 174, 0, 167, 0, 170, 0, 163, 0, 172, 0, 171, 0, _
165, 0, 164, 0, 173, 0, 166, 0, 181, 0, 182, 0, 183, 0, 184, 0, 185, 0, 199, 0, 200, 0, 201, 0, _
202, 0, 203, 0, 187, 0, 188, 0, 189, 0, 190, 0, 198, 0, 181, 0, 182, 0, 183, 0, 184, 0, 185, 0, _
199, 0, 200, 0, 201, 0, 202, 0, 203, 0, 187, 0, 188, 0, 189, 0, 190, 0, 198, 0, 204, 0, 206, 0, _
207, 0, 208, 0, 209, 0, 210, 0, 211, 0, 212, 0, 213, 0, 214, 0, 204, 0, 206, 0, 207, 0, 208, 0, _
209, 0, 210, 0, 211, 0, 212, 0, 213, 0, 214, 0, 215, 0, 216, 0, 220, 0, 221, 0, 222, 0, 215, 0, _
216, 0, 220, 0, 221, 0, 222, 0, 223, 0, 225, 0, 226, 0, 227, 0, 228, 0, 234, 0, 235, 0, 236, 0, _
237, 0, 238, 0, 229, 0, 230, 0, 231, 0, 232, 0, 233, 0, 223, 0, 225, 0, 226, 0, 227, 0, 228, 0, _
234, 0, 235, 0, 236, 0, 237, 0, 238, 0, 229, 0, 230, 0, 231, 0, 232, 0, 233, 0, 239, 0, 241, 0, _
242, 0, 243, 0, 244, 0, 245, 0, 246, 0, 247, 0, 248, 0, 249, 0, 239, 0, 241, 0, 242, 0, 243, 0, _
244, 0, 245, 0, 246, 0, 247, 0, 248, 0, 249, 0, 250, 0, 251, 0, 252, 0, 253, 0, 254, 0, 250, 0, _
251, 0, 252, 0, 253, 0, 244, 30)
windows1258_bytes = Array(226, 0, 32, 0, 3, 1, 32, 0, 194, 0, 32, 0, 2, 1, 32, 0, 17, 1, 32, 0, 16, 1, 32, 0, 25, 1, 32, 0, 24, 1, 32, 0, 81, 1, 32, 0, 244, 0, 32, 0, _
80, 1, 32, 0, 212, 0, 32, 0, 253, 0, 32, 0, 221, 0, 32, 0, 97, 0, 26, 1, 97, 0, 71, 1, 97, 0, 98, 1, 97, 0, 27, 1, 97, 0, 72, 1, 226, 0, 26, 1, 226, 0, 71, 1, 226, 0, _
98, 1, 226, 0, 27, 1, 226, 0, 72, 1, 3, 1, 26, 1, 3, 1, 71, 1, 3, 1, 98, 1, 3, 1, 27, 1, 3, 1, 72, 1, 65, 0, 26, 1, 65, 0, 71, 1, 65, 0, 98, 1, 65, 0, 27, 1, 65, 0, 72, 1, _
194, 0, 26, 1, 194, 0, 71, 1, 194, 0, 98, 1, 194, 0, 27, 1, 194, 0, 72, 1, 2, 1, 26, 1, 2, 1, 71, 1, 2, 1, 98, 1, 2, 1, 27, 1, 2, 1, 72, 1, 101, 0, 26, 1, 101, 0, 71, 1, _
101, 0, 98, 1, 101, 0, 27, 1, 101, 0, 72, 1, 25, 1, 26, 1, 25, 1, 71, 1, 25, 1, 98, 1, 25, 1, 27, 1, 25, 1, 72, 1, 69, 0, 26, 1, 69, 0, 71, 1, 69, 0, 98, 1, 69, 0, 27, 1, _
69, 0, 72, 1, 24, 1, 26, 1, 24, 1, 71, 1, 24, 1, 98, 1, 24, 1, 27, 1, 24, 1, 72, 1, 105, 0, 26, 1, 105, 0, 71, 1, 105, 0, 98, 1, 105, 0, 27, 1, 105, 0, 72, 1, 73, 0, 26, _
1, 73, 0, 71, 1, 73, 0, 98, 1, 73, 0, 27, 1, 73, 0, 72, 1, 111, 0, 26, 1, 111, 0, 71, 1, 111, 0, 98, 1, 111, 0, 27, 1, 111, 0, 72, 1, 81, 1, 26, 1, 81, 1, 71, 1, 81, 1, _
98, 1, 81, 1, 27, 1, 81, 1, 72, 1, 244, 0, 26, 1, 244, 0, 71, 1, 244, 0, 98, 1, 244, 0, 27, 1, 244, 0, 72, 1, 79, 0, 26, 1, 79, 0, 71, 1, 79, 0, 98, 1, 79, 0, 27, 1, _
79, 0, 72, 1, 80, 1, 26, 1, 80, 1, 71, 1, 80, 1, 98, 1, 80, 1, 27, 1, 80, 1, 72, 1, 212, 0, 26, 1, 212, 0, 71, 1, 212, 0, 98, 1, 212, 0, 27, 1, 212, 0, 72, 1, 117, 0, _
26, 1, 117, 0, 71, 1, 117, 0, 98, 1, 117, 0, 27, 1, 117, 0, 72, 1, 253, 0, 26, 1, 253, 0, 71, 1, 253, 0, 98, 1, 253, 0, 27, 1, 253, 0, 72, 1, 85, 0, 26, 1, 85, 0, _
71, 1, 85, 0, 98, 1, 85, 0, 27, 1, 85, 0, 72, 1, 221, 0, 26, 1, 221, 0, 71, 1, 221, 0, 98, 1, 221, 0, 27, 1, 221, 0, 72, 1, 121, 0, 26, 1, 121, 0, 71, 1, 121, 0, 98, 1, _
121, 0, 27, 1, 121, 0, 72, 1, 89, 0, 26, 1, 89, 0, 71, 1, 89, 0, 98, 1, 89, 0, 27, 1, 89, 0, 72, 1)
sort_dungsan_bytes = Array(48, 0, 49, 0, 50, 0, 51, 0, 52, 0, 53, 0, 54, 0, 55, 0, 56, 0, 57, 0, _
58, 0, 59, 0, 60, 0, 61, 0, 62, 0, 63, 0, 64, 0, 91, 0, 92, 0, 93, 0, 94, 0, 95, 0, 123, 0, 124, 0, _
125, 0, 126, 0, 97, 0, 224, 0, 163, 30, 227, 0, 225, 0, 161, 30, 3, 1, 177, 30, 179, 30, 181, 30, _
175, 30, 183, 30, 226, 0, 167, 30, 169, 30, 171, 30, 165, 30, 173, 30, 98, 0, 99, 0, 100, 0, 17, 1, _
101, 0, 232, 0, 187, 30, 189, 30, 233, 0, 185, 30, 234, 0, 193, 30, 195, 30, 197, 30, 191, 30, _
199, 30, 102, 0, 103, 0, 104, 0, 105, 0, 236, 0, 201, 30, 41, 1, 237, 0, 203, 30, 106, 0, 107, 0, _
108, 0, 109, 0, 110, 0, 111, 0, 242, 0, 207, 30, 245, 0, 243, 0, 205, 30, 244, 0, 211, 30, 213, _
30, 215, 30, 209, 30, 217, 30, 161, 1, 221, 30, 223, 30, 225, 30, 219, 30, 227, 30, 112, 0, 113, _
0, 114, 0, 115, 0, 116, 0, 117, 0, 249, 0, 231, 30, 105, 1, 250, 0, 229, 30, 176, 1, 235, 30, 237, _
30, 239, 30, 233, 30, 241, 30, 118, 0, 119, 0, 120, 0, 121, 0, 243, 30, 247, 30, 249, 30, 253, 0, _
245, 30, 122, 0, 65, 0, 192, 0, 162, 30, 195, 0, 193, 0, 160, 30, 2, 1, 176, 30, 178, 30, 180, 30, _
174, 30, 182, 30, 194, 0, 166, 30, 168, 30, 170, 30, 164, 30, 172, 30, 66, 0, 67, 0, 68, 0, 16, 1, _
69, 0, 200, 0, 186, 30, 188, 30, 201, 0, 184, 30, 202, 0, 192, 30, 194, 30, 196, 30, 190, 30, 198, _
30, 70, 0, 71, 0, 72, 0, 73, 0, 204, 0, 200, 30, 40, 1, 205, 0, 202, 30, 74, 0, 75, 0, 76, 0, 77, 0, 78, _
0, 79, 0, 210, 0, 206, 30, 213, 0, 211, 0, 204, 30, 212, 0, 210, 30, 212, 30, 214, 30, 208, 30, _
216, 30, 160, 1, 220, 30, 222, 30, 224, 30, 218, 30, 226, 30, 80, 0, 81, 0, 82, 0, 83, 0, 84, 0, 85, _
0, 217, 0, 230, 30, 104, 1, 218, 0, 228, 30, 175, 1, 234, 30, 236, 30, 238, 30, 232, 30, 240, 30, _
86, 0, 87, 0, 88, 0, 89, 0, 242, 30, 246, 30, 248, 30, 221, 0, 244, 30, 90, 0)
sort_vn3_bytes = Array(48, 0, 49, 0, 50, 0, 51, 0, 52, 0, 53, 0, 54, 0, 55, 0, 56, 0, 57, 0, 58, 0, 59, _
0, 60, 0, 61, 0, 62, 0, 63, 0, 64, 0, 91, 0, 92, 0, 93, 0, 94, 0, 95, 0, 123, 0, 124, 0, 125, 0, 126, 0, _
97, 0, 181, 0, 182, 0, 183, 0, 184, 0, 185, 0, 168, 0, 187, 0, 188, 0, 189, 0, 190, 0, 198, 0, 169, _
0, 199, 0, 200, 0, 201, 0, 202, 0, 203, 0, 98, 0, 99, 0, 100, 0, 174, 0, 101, 0, 204, 0, 206, 0, 207, _
0, 208, 0, 209, 0, 170, 0, 210, 0, 211, 0, 212, 0, 213, 0, 214, 0, 102, 0, 103, 0, 104, 0, 105, 0, _
215, 0, 216, 0, 220, 0, 221, 0, 222, 0, 106, 0, 107, 0, 108, 0, 109, 0, 110, 0, 111, 0, 223, 0, 225, _
0, 226, 0, 227, 0, 228, 0, 171, 0, 229, 0, 230, 0, 231, 0, 232, 0, 233, 0, 172, 0, 234, 0, 235, 0, _
236, 0, 237, 0, 238, 0, 112, 0, 113, 0, 114, 0, 115, 0, 116, 0, 117, 0, 239, 0, 241, 0, 242, 0, 243, _
0, 244, 0, 173, 0, 245, 0, 246, 0, 247, 0, 248, 0, 249, 0, 118, 0, 119, 0, 120, 0, 121, 0, 250, 0, _
251, 0, 252, 0, 253, 0, 254, 0, 122, 0, 65, 0, 181, 0, 182, 0, 183, 0, 184, 0, 185, 0, 161, 0, 187, _
0, 188, 0, 189, 0, 190, 0, 198, 0, 162, 0, 199, 0, 200, 0, 201, 0, 202, 0, 203, 0, 66, 0, 67, 0, 68, _
0, 167, 0, 69, 0, 204, 0, 206, 0, 207, 0, 208, 0, 209, 0, 163, 0, 210, 0, 211, 0, 212, 0, 213, 0, 214, _
0, 70, 0, 71, 0, 72, 0, 73, 0, 215, 0, 216, 0, 220, 0, 221, 0, 222, 0, 74, 0, 75, 0, 76, 0, 77, 0, 78, 0, _
79, 0, 223, 0, 225, 0, 226, 0, 227, 0, 228, 0, 164, 0, 229, 0, 230, 0, 231, 0, 232, 0, 233, 0, 165, _
0, 234, 0, 235, 0, 236, 0, 237, 0, 238, 0, 80, 0, 81, 0, 82, 0, 83, 0, 84, 0, 85, 0, 239, 0, 241, 0, _
242, 0, 243, 0, 244, 0, 166, 0, 245, 0, 246, 0, 247, 0, 248, 0, 249, 0, 86, 0, 87, 0, 88, 0, 89, 0, _
250, 0, 251, 0, 252, 0, 253, 0, 254, 0, 90, 0)
sort_vni_bytes = Array(48, 0, 32, 0, 49, 0, 32, 0, 50, 0, 32, 0, 51, 0, 32, 0, 52, 0, 32, 0, 53, 0, 32, 0, 54, 0, 32, 0, 55, 0, 32, 0, 56, 0, 32, 0, 57, 0, 32, 0, 58, 0, 32, 0, 59, 0, 32, 0, 60, 0, 32, 0, 61, 0, _
32, 0, 62, 0, 32, 0, 63, 0, 32, 0, 64, 0, 32, 0, 91, 0, 32, 0, 92, 0, 32, 0, 93, 0, 32, 0, 94, 0, 32, 0, 95, 0, 32, 0, 123, 0, 32, 0, 124, 0, 32, 0, 125, 0, 32, 0, 126, 0, 32, 0, 97, 0, 32, 0, 97, 0, 248, 0, 97, _
0, 251, 0, 97, 0, 245, 0, 97, 0, 249, 0, 97, 0, 239, 0, 97, 0, 234, 0, 97, 0, 232, 0, 97, 0, 250, 0, 97, 0, 252, 0, 97, 0, 233, 0, 97, 0, 235, 0, 97, 0, 226, 0, 97, 0, 224, 0, 97, 0, 229, 0, 97, 0, 227, 0, _
97, 0, 225, 0, 97, 0, 228, 0, 98, 0, 32, 0, 99, 0, 32, 0, 100, 0, 32, 0, 241, 0, 32, 0, 101, 0, 32, 0, 101, 0, 248, 0, 101, 0, 251, 0, 101, 0, 245, 0, 101, 0, 249, 0, 101, 0, 239, 0, 101, 0, 226, 0, 101, _
0, 224, 0, 101, 0, 229, 0, 101, 0, 227, 0, 101, 0, 225, 0, 101, 0, 228, 0, 102, 0, 32, 0, 103, 0, 32, 0, 104, 0, 32, 0, 105, 0, 32, 0, 236, 0, 32, 0, 230, 0, 32, 0, 243, 0, 32, 0, 237, 0, 32, 0, 242, 0, _
32, 0, 106, 0, 32, 0, 107, 0, 32, 0, 108, 0, 32, 0, 109, 0, 32, 0, 110, 0, 32, 0, 111, 0, 32, 0, 111, 0, 248, 0, 111, 0, 251, 0, 111, 0, 245, 0, 111, 0, 249, 0, 111, 0, 239, 0, 111, 0, 226, 0, 111, 0, _
224, 0, 111, 0, 229, 0, 111, 0, 227, 0, 111, 0, 225, 0, 111, 0, 228, 0, 244, 0, 32, 0, 244, 0, 248, 0, 244, 0, 251, 0, 244, 0, 245, 0, 244, 0, 249, 0, 244, 0, 239, 0, 112, 0, 32, 0, 113, 0, 32, 0, 114, _
0, 32, 0, 115, 0, 32, 0, 116, 0, 32, 0, 117, 0, 32, 0, 117, 0, 248, 0, 117, 0, 251, 0, 117, 0, 245, 0, 117, 0, 249, 0, 117, 0, 239, 0, 246, 0, 32, 0, 246, 0, 248, 0, 246, 0, 251, 0, 246, 0, 245, 0, 246, _
0, 249, 0, 246, 0, 239, 0, 118, 0, 32, 0, 119, 0, 32, 0, 120, 0, 32, 0, 121, 0, 32, 0, 121, 0, 248, 0, 121, 0, 251, 0, 121, 0, 245, 0, 121, 0, 249, 0, 238, 0, 32, 0, 122, 0, 32, 0, 65, 0, 32, 0, 65, 0, 216, _
0, 65, 0, 219, 0, 65, 0, 213, 0, 65, 0, 217, 0, 65, 0, 207, 0, 65, 0, 202, 0, 65, 0, 200, 0, 65, 0, 218, 0, 65, 0, 220, 0, 65, 0, 201, 0, 65, 0, 203, 0, 65, 0, 194, 0, 65, 0, 192, 0, 65, 0, 197, 0, 65, 0, 195, _
0, 65, 0, 193, 0, 65, 0, 196, 0, 66, 0, 32, 0, 67, 0, 32, 0, 68, 0, 32, 0, 209, 0, 32, 0, 69, 0, 32, 0, 69, 0, 216, 0, 69, 0, 219, 0, 69, 0, 213, 0, 69, 0, 217, 0, 69, 0, 207, 0, 69, 0, 194, 0, 69, 0, 192, 0, _
69, 0, 197, 0, 69, 0, 195, 0, 69, 0, 193, 0, 69, 0, 196, 0, 70, 0, 32, 0, 71, 0, 32, 0, 72, 0, 32, 0, 73, 0, 32, 0, 204, 0, 32, 0, 198, 0, 32, 0, 211, 0, 32, 0, 205, 0, 32, 0, 210, 0, 32, 0, 74, 0, 32, 0, 75, 0, _
32, 0, 76, 0, 32, 0, 77, 0, 32, 0, 78, 0, 32, 0, 79, 0, 32, 0, 79, 0, 216, 0, 79, 0, 219, 0, 79, 0, 213, 0, 79, 0, 217, 0, 79, 0, 207, 0, 79, 0, 194, 0, 79, 0, 192, 0, 79, 0, 197, 0, 79, 0, 195, 0, 79, 0, 193, _
0, 79, 0, 196, 0, 212, 0, 32, 0, 212, 0, 216, 0, 212, 0, 219, 0, 212, 0, 213, 0, 212, 0, 217, 0, 212, 0, 207, 0, 80, 0, 32, 0, 81, 0, 32, 0, 82, 0, 32, 0, 83, 0, 32, 0, 84, 0, 32, 0, 85, 0, 32, 0, 85, 0, 216, _
0, 85, 0, 219, 0, 85, 0, 213, 0, 85, 0, 217, 0, 85, 0, 207, 0, 214, 0, 32, 0, 214, 0, 216, 0, 214, 0, 219, 0, 214, 0, 213, 0, 214, 0, 217, 0, 214, 0, 207, 0, 86, 0, 32, 0, 87, 0, 32, 0, 88, 0, 32, 0, 89, 0, _
32, 0, 89, 0, 216, 0, 89, 0, 219, 0, 89, 0, 213, 0, 89, 0, 217, 0, 206, 0, 32, 0, 90, 0, 32, 0)
ReDim a(268)
For k = 0 To 267
a(k) = dungsan_bytes(k)
Next k
s_dung_san = a
For k = 0 To 267
a(k) = vn3_bytes(k)
Next k
s_vn3 = a
ReDim a(508)
For k = 0 To 507
a(k) = tohop_bytes(k)
Next k
s_to_hop = a
ReDim a(536)
For k = 0 To 535
a(k) = vni_bytes(k)
Next k
s_vni = a
For k = 0 To 535
a(k) = windows1258_bytes(k)
Next k
s_windows1258 = a
ReDim a(424)
For k = 0 To 423
a(k) = sort_dungsan_bytes(k)
Next k
sort_dung_san = a
For k = 0 To 423
a(k) = sort_vn3_bytes(k)
Next k
sort_vn3 = a
ReDim a(848)
For k = 0 To 847
a(k) = sort_vni_bytes(k)
Next k
sort_vni = a
Erase a, dungsan_bytes, tohop_bytes, vni_bytes, vn3_bytes, sort_dungsan_bytes, sort_vn3_bytes, sort_vni_bytes
End Sub
Public Function SourceToDest(ByVal text As String, source As convert_source, dest As convert_dest) As String
Dim s As String, temp As String, kytu2 As String
Dim n As Long, index As Long, k As Long
Dim nr As Long
If source = dest And source <> src_uni Then
SourceToDest = text
Exit Function
End If
InitVietnameseStr
text = text & " "
s = ""
n = 1
k = Len(text)
While n < k
nr = 0
Select Case source
Case src_uni, src_vni, src_windows1258:
kytu2 = Mid(text, n, 2)
If source = src_uni Then
index = InStr(1, s_to_hop, kytu2)
If index > 14 Then
nr = (index + 15) \ 2
n = n + 2
End If
If nr = 0 Then
kytu2 = Mid(kytu2, 1, 1)
nr = InStr(1, s_dung_san, kytu2)
n = n + 1
End If
Else
If source = src_vni Then
temp = s_vni
Else
temp = s_windows1258
End If
index = InStr(1, temp, kytu2)
If index Mod 2 = 1 Then
nr = (index + 1) \ 2
n = n + 2
End If
If nr = 0 Then
kytu2 = Mid(kytu2, 1, 1)
index = InStr(1, temp, kytu2 & " ")
If index > 0 Then nr = (index + 1) \ 2
n = n + 1
End If
End If
Case Else
kytu2 = Mid(text, n, 1)
index = InStr(1, s_vn3, kytu2)
If index > 0 Then nr = index
n = n + 1
End Select
If nr > 0 Then
Select Case dest
Case dst_uni: kytu2 = Mid(s_dung_san, nr, 1)
Case dst_vni: kytu2 = Trim(Mid(s_vni, 2 * nr - 1, 2))
Case dst_vn3: kytu2 = Mid(s_vn3, nr, 1)
Case dst_windows1258: kytu2 = Trim(Mid(s_windows1258, 2 * nr - 1, 2))
Case dst_khongdau: kytu2 = Mid(s_khong_dau, nr, 1)
End Select
End If
s = s & kytu2
Wend
SourceToDest = s
End Function
- Còn để sửa đổi CSDL hiện tại thì bạn có thể mở table, dùng vòng lặp duyệt qua từng Field dạng text rồi chuyển thành Unicode dựng sẳn.
Mã PHP:Sub convUni()
[/font][/size]
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("Select * From tblTest")
rs.MoveFirst
Do Until rs.EOF
rs.Edit
rs!Hoten = SourceToDest(rs!Hoten, 1, 1)
rs.Update
rs.MoveNext
Loop
[size=medium][font=Georgia]End Sub
ongke0711 > 11-04-19, 11:37 AM
Minh Tiên > 23-10-19, 03:30 PM
mrsiro > 23-10-19, 04:26 PM
ongke0711 > 23-10-19, 08:25 PM
(23-10-19, 03:30 PM)Minh Tiên Đã viết: Tiên đang test code chuyển Unicode từ Tổ hợp sang dựng sẳn của bạn, xãy ra các lỗi: Ứng => ứng; Ế => ế, ... nhưng ko biết điều chỉnh đoạn nào ?
Nhờ ongke0711 chỉ giúp.
Thanks bạn./.
Minh Tiên > 24-10-19, 09:39 AM
Minh Tiên > 24-10-19, 05:43 PM
ongke0711 > 24-10-19, 07:14 PM
(24-10-19, 05:43 PM)Minh Tiên Đã viết: ongke0711 ơi !
Tiên muốn chuyển ngược lại từ Uni Dựng sẳn sang Uni Tổ hợp thì theo code trên của bạn cần edit ntn bạn ?
Thật đau đầu với Tổ hợp và Dựng sẳn ! Mong bạn chia sẻ.
Cảm ơn nhiều./.