cancel
Showing results for 
Search instead for 
Did you mean: 

Txt with special characters

GilbertoLopez
Level 3
Hi everybody, i have to read a txt file which is in spanish, the problem here is that some words are with accent (´) which is a special character and when i read my file that character is changed by this character (�). I have tried using a schema.ini file to define a charset but it doesn't work. i hope someone of you know how to resolve this.

Thank you in advance four your help.

------------------------------
Gilberto Lopez
Senior Consultant
Indra
America/Mexico_City
------------------------------
3 REPLIES 3

RoarNilsen
Level 3
In a similiar situation I created a new object "Read lines with encoding"
Have to supply the correct encoding to read the file.
Like EncodingName = "iso-8859-1"

The objected was based on standard action "Read lines from file" in Utility - File Management".
Here is the code in the code stage
' Assume success
Success = True
Message = ""
Dim enc As System.Text.Encoding
Try
	enc = System.Text.Encoding.GetEncoding(EncodingName)

	Lines = New DataTable()
	Lines.Columns.Add("Line", GetType(String))

	Using sr As New StreamReader(File_Path, enc)

		EOF = False
		Start_Line = Math.Max(1, Start_Line)

		Dim line as String
		Dim lineNo As Integer = 0
		Do
			line = sr.ReadLine()
			lineNo += 1

			If line Is Nothing Then EOF = True : Exit Do
			If lineNo >= Start_Line Then Lines.Rows.Add(line)
			If lineNo = End_Line Then Exit Do

		Loop Until line Is Nothing
		Line_Count = Lines.Rows.Count

	End Using

Catch ex As Exception
	Success = False
	Message = ex.Message

End Try​

New text input parameter
EncodingName

------------------------------
Roar Nilsen
Manager
Duit AS
Europe/Oslo
------------------------------

Hi, i'm going to try your solution hoping it works.

Thanks a lot.

Regards

------------------------------
Gilberto Lopez
Senior Consultant
Indra
America/Mexico_City
------------------------------

IngridOlsen
Level 4
Hi Gilberto.
I am assuming you are using OCR functionality. If not, this is probably not useful/relevant.

However, I had a similar problem in Danish where we also have special characters, and what helped was installing the correct Tesseract language files under BluePrism folder.

Best regards
Ingrid





------------------------------
Ingrid Olsen
Configurator and proces consultant
Forca
Europe/Copenhagen
------------------------------