How to read a unicode TXT file
How to read a unicode TXT file
Hi,
What is the instruction to open a Unicode TXT file .
Thanks for your help .
What is the instruction to open a Unicode TXT file .
Thanks for your help .
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: How to read a unicode TXT file
MemoRead() or any other file read function of (x)Harbour can read Unicode (utf-8) text file.
For display and edit Unicode text set FW_SetUnicode( .T. ). MemoEdit() and GET MEMO can edit and save Unicode text.
For display and edit Unicode text set FW_SetUnicode( .T. ). MemoEdit() and GET MEMO can edit and save Unicode text.
Code: Select all | Expand
local cUnicodeText
FW_SetUnicode( .t. )
cUnicodeText := MEMOREAD( "unicode.txt" )
MEMOEDIT( cUnicodeText )
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- goosfancito
- Posts: 1955
- Joined: Fri Oct 07, 2005 7:08 pm
Re: How to read a unicode TXT file
Buen dia.
este codigo al ejecutarlo no me visualiza bien las lineas. no me aparecen las ñ
este codigo al ejecutarlo no me visualiza bien las lineas. no me aparecen las ñ
Code: Select all | Expand
hF := ttxtFile():new( cFilePath( exename() ) + "doc\1.txt" )
FW_SetUnicode( .T. )
hf := MemoRead( cFilePath( exename() ) + "doc\1.txt" )
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: How to read a unicode TXT file
1.txt may not be containing UTF8 text.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- goosfancito
- Posts: 1955
- Joined: Fri Oct 07, 2005 7:08 pm
Re: How to read a unicode TXT file
me pasa que esta linea me la transforma en 2 lineas:
hasta cuando lo muestro en un xbrowse
Code: Select all | Expand
Shampoo Anti Age con Acido Hialuronico Cab. Dañados por el paso del tiempo 1 Lt C/valv
hasta cuando lo muestro en un xbrowse
Code: Select all | Expand
hf := memoread( cFilePath( exename() ) + "doc\1.txt" )
FOR x = 1 TO MLCount( hf )
cLinea:= MemoLine( hf,,x,.t.)
AAdd(a, cLinea)
NEXT
XBROWSER a
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: How to read a unicode TXT file
Code: Select all | Expand
#include "fivewin.ch"
function Main()
local oDlg, oFont, oBrw, cText
cText := "Shampoo Anti Age con Acido Hialuronico Cab. Dañados por el paso del tiempo 1 Lt C/valv"
? cText
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-20
DEFINE DIALOG oDlg SIZE 560,200 PIXEL TRUEPIXEL FONT oFont
@ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE { cText } ;
COLUMNS 1 HEADERS "TEXT" COLSIZES 500 ;
LINES NOBORDER
WITH OBJECT oBrw
:nRowHeight := 60
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
![Image](https://imagizer.imageshack.com/v2/xq90/923/dn1oGi.png)
![Image](https://imagizer.imageshack.com/v2/xq90/922/RPga3W.png)
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: How to read a unicode TXT file
goosfancito wrote:me pasa que esta linea me la transforma en 2 lineas:Code: Select all | Expand
Shampoo Anti Age con Acido Hialuronico Cab. Dañados por el paso del tiempo 1 Lt C/valv
hasta cuando lo muestro en un xbrowseCode: Select all | Expand
hf := memoread( cFilePath( exename() ) + "doc\1.txt" )
FOR x = 1 TO MLCount( hf )
cLinea:= MemoLine( hf,,x,.t.)
AAdd(a, cLinea)
NEXT
XBROWSER a
Look at the second parameter of MLCount() and MemoLine. Set a proper value.
EMG