|
@@ -2,12 +2,11 @@ Option Compare Database
|
|
|
Option Private Module
|
|
Option Private Module
|
|
|
Option Explicit
|
|
Option Explicit
|
|
|
|
|
|
|
|
-'Dim UTF8CONVERSION As Boolean
|
|
|
|
|
-'Public Sub activate_Utf8Conversion()
|
|
|
|
|
-' UTF8CONVERSION = True
|
|
|
|
|
-'End Sub
|
|
|
|
|
|
|
+Public Function utf8_conversion() As Boolean
|
|
|
|
|
+' utf8 conversion is needed for Access 2007 and later
|
|
|
|
|
+ utf8_conversion = (CurrentProject.FileFormat >= acFileFormatAccess2007)
|
|
|
|
|
|
|
|
-Const UTF8CONVERSION = True
|
|
|
|
|
|
|
+End Function
|
|
|
|
|
|
|
|
Public Function get_container_name(ByVal acType As Integer)
|
|
Public Function get_container_name(ByVal acType As Integer)
|
|
|
'return the name of an access object container from its acType
|
|
'return the name of an access object container from its acType
|
|
@@ -40,7 +39,7 @@ Public Sub ExportDocument(ByVal acType As Integer, ByVal obj_name As String, ByV
|
|
|
Application.SaveAsText acType, obj_name, file_path
|
|
Application.SaveAsText acType, obj_name, file_path
|
|
|
|
|
|
|
|
If acType <> acModule Then
|
|
If acType <> acModule Then
|
|
|
- If UTF8CONVERSION Then
|
|
|
|
|
|
|
+ If utf8_conversion() Then
|
|
|
logger "ExportDocument", "DEBUG", "Encode file in UTF-8"
|
|
logger "ExportDocument", "DEBUG", "Encode file in UTF-8"
|
|
|
Dim tempFileName As String
|
|
Dim tempFileName As String
|
|
|
tempFileName = TempFile()
|
|
tempFileName = TempFile()
|
|
@@ -67,7 +66,7 @@ Public Sub ImportDocument(ByVal acType As Integer, ByVal obj_name As String, ByV
|
|
|
logger "ImportDocument", "DEBUG", "Try to import " & obj_name & "(type " & acType & ") from: " & file_path
|
|
logger "ImportDocument", "DEBUG", "Try to import " & obj_name & "(type " & acType & ") from: " & file_path
|
|
|
|
|
|
|
|
If acType <> acModule Then
|
|
If acType <> acModule Then
|
|
|
- If UTF8CONVERSION Then
|
|
|
|
|
|
|
+ If utf8_conversion() Then
|
|
|
logger "ImportDocument", "DEBUG", "Encode in UCS2 before import"
|
|
logger "ImportDocument", "DEBUG", "Encode in UCS2 before import"
|
|
|
tempFileName = TempFile()
|
|
tempFileName = TempFile()
|
|
|
ConvertUtf8Ucs2 file_path, tempFileName
|
|
ConvertUtf8Ucs2 file_path, tempFileName
|