Reading an Hebrew text file cause gibberish when saving to table (1 Viewer)

bmkol

Member
Local time
Today, 08:29
Joined
Dec 2, 2021
Messages
39
Hi everyone

Reading an Hebrew text file cause gibberish when saving to table. I attached screen shot and the vba code ==>

Public Function KraPirsomotMeKovetzMekomi()

Dim objFSO As Object
Dim objTextStream As Object
Dim strTextLine As String
Dim strInputFileName As String

'On Error GoTo FileNotFound
strInputFileName = CurrentProject.Path & "\" & "maasrotads.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
'objFSO.Charset = "utf-8"
Set objTextStream = objFSO.OpenTextFile(strInputFileName)

Do While Not (objTextStream.AtEndOfStream)
strTextLine = objTextStream.ReadLine
Teur = strTextLine
strTextLine = objTextStream.ReadLine
Ktovet = strTextLine
strTextLine = objTextStream.ReadLine
Tmuna = strTextLine
HachnesPirsomotLaTavla
Loop

objTextStream.Close

ClearObjects:
Set objFSO = Nothing
Set objTextStream = Nothing
On Error GoTo 0
Exit Function

FileNotFound:
HachnesPirsomotKvuimLaTavla
Resume ClearObjects

End Function

1638435034069.png
 

Jon

Access World Site Owner
Staff member
Local time
Today, 06:29
Joined
Sep 28, 1999
Messages
7,305
Welcome to the forums! We are the most active Microsoft Access community on the internet by far, with posts going back over 20 years!

To get started, I highly recommend you read the post below. It contains important information for all new users to this forum.

https://www.access-programmers.co.uk/forums/threads/new-member-read-me-first.223250/

We look forward to having you around here, learning stuff and having fun!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:29
Joined
May 7, 2009
Messages
19,169
is your Regional language set to Hebrew?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:29
Joined
May 7, 2009
Messages
19,169
you already have set the Charset, why did you comment out?
using plain ascii will loose all those accent characters.
 

bmkol

Member
Local time
Today, 08:29
Joined
Dec 2, 2021
Messages
39
you already have set the Charset, why did you comment out?
using plain ascii will loose all those accent characters.
Saving the text file with Plain Acii give me ???????? .... it must be with utf-8
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:29
Joined
May 7, 2009
Messages
19,169
that is what i am saying you Commented the CharSet in your code?
will this help:
 

bmkol

Member
Local time
Today, 08:29
Joined
Dec 2, 2021
Messages
39
I will explain myself better.
The text file is in utf-8.
The language in the text is Hebrew.
When I open the text I can read the Hebrew with no problem.
When I open the text file with vba reading line by line the text is gibberish.
This is my problem and I don't know how to solve it.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:29
Joined
May 7, 2009
Messages
19,169
it is garbage because you are reading it in Plain text.
can you post a sample txt file?
you did not try the (possible) solution offered on the link i gave?
then you can google further for other solutions (possible)
 

bmkol

Member
Local time
Today, 08:29
Joined
Dec 2, 2021
Messages
39
I attched a sample text file that has a hebrew line and then link lilne and an image line.
I hope I'm not too much bothering and really appriciate your effort to help me.
 

Attachments

  • sample.txt
    764 bytes · Views: 328

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:29
Joined
May 7, 2009
Messages
19,169
see this demo if you can get the Hebrew text to the table.
the code i am using to extract the text is from the
same Link i gave you.
 

Attachments

  • hebrewText.accdb
    496 KB · Views: 372

bmkol

Member
Local time
Today, 08:29
Joined
Dec 2, 2021
Messages
39
Wow ..... you are really expert ... I spent days and night to solve it ... and there are so many like me with the same problem ... unbelievable!!!!
I did see the link you gave me but I didn't really understand it.

I wil update you soon after I will change the code in my file.

Thank you so much
 

bmkol

Member
Local time
Today, 08:29
Joined
Dec 2, 2021
Messages
39
see this demo if you can get the Hebrew text to the table.
the code i am using to extract the text is from the
same Link i gave you.
I'm really impress from you .... You saved me so much time ... I was really depress from it ... It works really good ... here is a screnn sot ==>
1638452747271.png
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:29
Joined
Sep 21, 2011
Messages
14,048
Wow ..... you are really expert ... I spent days and night to solve it ... and there are so many like me with the same problem ... unbelievable!!!!
I did see the link you gave me but I didn't really understand it.

I wil update you soon after I will change the code in my file.

Thank you so much
If you do not understand something, you should say so. Not just ignore the advice.
 

Users who are viewing this thread

Top Bottom