Special Characters (1 Viewer)

Luciano

Registered User.
Local time
Today, 04:27
Joined
Jul 29, 2007
Messages
25
Hi, I do export with php an MySQL table into an Access 2013 table. It's working fine but special characters (i.e. é à è ë ü ..) in my fields becomes totaly unrecognizable characters. How can I avoid this ?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 03:27
Joined
Sep 12, 2006
Messages
15,730
doesn't access 2013 offer a new rich-text option for controls (and fields?)

try investigating that, possibly
 

spikepl

Eledittingent Beliped
Local time
Today, 04:27
Joined
Nov 3, 2010
Messages
6,142
I do export with php an MySQL table into an Access 2013 table

How? It is presumably an issue of different encoding.
 

Luciano

Registered User.
Local time
Today, 04:27
Joined
Jul 29, 2007
Messages
25
As a matter of fact, someone who is specialised in mySQL and php imports/exports some tables with 'DBSync for MS Access & MySQL' in/from my Access 2013-database.
He told me that I have to solve this issue (something like set utf-8 in my Access-database) ???
 

spikepl

Eledittingent Beliped
Local time
Today, 04:27
Joined
Nov 3, 2010
Messages
6,142
If you wish to keep the procedure secret that's fine. Someone else might perhaps help you.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 03:27
Joined
Sep 12, 2006
Messages
15,730
I don't think he's saying that he has the answer, spike.

I think he's been tipped off that he needs some way of getting at a different character set to the default one.

that's why I wondered whether there was a table level option for rich text settings.
 

Luciano

Registered User.
Local time
Today, 04:27
Joined
Jul 29, 2007
Messages
25
Here is the solution to decode from utf8 in Unicode

' Decodes a UTF-8 string in Windows (Unicode)-string
'Returns:
' A Windows (Unicode) string
Function UTF8_Decode(ByVal sStr As String)
Dim l As Long, sUTF8 As String, iChar As Integer, iChar2 As Integer
For l = 1 To Len(sStr)
iChar = Asc(Mid(sStr, l, 1))
If iChar > 127 Then
If Not iChar And 32 Then ' 2 chars
iChar2 = Asc(Mid(sStr, l + 1, 1))
sUTF8 = sUTF8 & ChrW$(((31 And iChar) * 64 + (63 And iChar2)))
l = l + 1
Else
Dim iChar3 As Integer
iChar2 = Asc(Mid(sStr, l + 1, 1))
iChar3 = Asc(Mid(sStr, l + 2, 1))
sUTF8 = sUTF8 & ChrW$(((iChar And 15) * 16 * 256) + ((iChar2 And 63) * 64) + (iChar3 And 63))
l = l + 2
End If
Else
sUTF8 = sUTF8 & Chr$(iChar)
End If
Next l
UTF8_Decode = sUTF8
End Function

'Encode from (Windows)Unicode in UTF-8:
'Returns:
' AN UTF-8 string
Function UTF8_Encode(sStr As String) As String
On Error GoTo ErrorUTF8_Encode
Dim i
Dim c
i = 1
Do While i <= Len(sStr)
c = Asc(Mid(sStr, i, 1))
If c >= &H80 Then
sStr = Left(sStr, i - 1) + Chr(&HC2 + ((c And &H40) / &H40)) + Chr(c And &HBF) + Mid(sStr, i + 1)
i = i + 1
End If
i = i + 1
Loop
UTF8_Encode = sStr
ExitError:
Exit Function
ErrorUTF8_Encode:
UTF8_Encode = sStr
MsgBox "ErrorUTF8_Encode"
Resume ExitError
End Function
 

Users who are viewing this thread

Top Bottom