Question : Exporting a table

Months ago I asked a question, but my problem has nevere been solved (see Q.10064151). So here it is agian :

When I save a MS-Access table as an external text file, all foreign characters such as umlauts, accents are converted to other characters. This implies a loss of the original German, Spanish text. How can I prevent this and keep the original characters.

P.S. This problem does not occurr when export to a dBase file first, but it is quit timeconsuming to save as dBase and than convert the dBase file to a text file.

Answer : Exporting a table

Yes, this is a really pain for all of us non-englishusers. Here in Norway we have 3 special characters and it is really givein' us a lot of headache.

I have written two functions that uses API calls to trnaslate from ANSI to OEM and vice versa. It have helped me out many times, hote it can do tha same for you:
here are the code, you have to run the data trough one of the function when you export them.


Declare Function OemToAnsi Lib "user32" Alias "OemToCharA" (ByVal lpszSrc As String, ByVal lpszDst As String) As Long
Declare Function AnsiToOem Lib "user32" Alias "CharToOemA" (ByVal lpszSrc As String, ByVal lpszDst As String) As Long


Function a2o(inn As String) As String
    Dim ut As String
    Dim T As Integer
    inn = inn & Chr$(0)            
    ut = Space$(Len(inn))      
    T = AnsiToOem(inn, ut)        
    ut = Left$(ut, Len(ut) - 1)  
    a2o = ut                      
End Function

Function o2a(inn As String) As String
    Dim ut As String
    Dim T As Integer
    inn = inn & Chr$(0)            
    ut = Space$(Len(inn))      
    T = OemToAnsi(inn, ut)        
    ut = Left$(ut, Len(ut) - 1)  
    o2a = ut                      
End Function


perove
Random Solutions  
 
programming4us programming4us