Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can I tell to access to read from utf-8 text file

Status
Not open for further replies.

lazaridisaris

Programmer
May 3, 2006
26
GR
I have some text files that are written in utf-8 encoding.

My problem is that when I read the file the special (greek) characters are unreadable.

I have used the
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.getfile(TmpFile)
Set ts = f.OpenAsTextStream(ForReading, TristateTrue)
Set con = APPLICATION.CurrentProject.Connection

code

please help

Regards
Aris
 
Text that uses umlaut characters may not correctly
import in Office Access 2003
View products that this article applies to.
Article ID : 899600
Last Review : May 18, 2005
Revision : 1.0
SYMPTOMS
Consider the following scenario. You try to
import a file into a Microsoft Office Access
2003 database as a new table by using the
Text Import Wizard. If the data in the file
contains text that uses the following umlaut characters, these characters may
not correctly import into Access 2003:
• Ää
• Öö
• Üü
Back to the top
CAUSE
This issue occurs when the default code page for the Text Import Wizard is not
set to Unicode (UTF-8). When a different code page is selected, the umlaut
characters may be mapped to different characters.
Back to the top
RESOLUTION
To resolve this issue, follow these steps:
1. In Access 2003, click Table in the Objects pane of the database window.
2. Click New on the Database toolbar.
3. In the New Table list, click Import Table, and then click OK.
4. In the Files of Type list, click Text file (*.txt, *.csv, *.tab, *.asc).
5. Locate and then click the source file that you want to import in to the
database, and then click Open.
6. Click Advance.
7. In the Code Page list, click Unicode (UTF-8), and then click OK.
8. Click Finish to import the table.
 
thanks for your reply.

This is correct but i want to do it from VB code to manipulate what is in the data.

Is it possible to do it through VBA?
 
Have you tried this ?
Set ts = f.OpenAsTextStream(ForReading, -1)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
If you take a look at my initial post is the first that I have tried.

But thanks
 
There is no evidence in your initial post that TristateTrue is recognised as a member of the Scripting.Tristate Enum...
Tip: use the Option Explicit instruction.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
the tristateTrue is = -1
and the Option Explicit is there
but Greek Letters are not showing at all
Only if I Open with Notepad the text file And save it as Unicode from UTF-8.

Then I can read it through Access without any problem.

Do you know a way to do it through VBA instad doing it manualy?
(To convert the text from UTF-8 to Unicode)

Thanks

Aris
 
Although my Spanish are fake I will try this and let you know for the results.

Thanks

Aris
 
I just tried it out with no luck.

It returns characters in a format readable only from Html pages.

But either way thanks for your time.

I will keep looking.
Regards

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top