Jump to content

Problem with encode text


Recommended Posts

Hello,

I have this codde :
 

Func _News()

    Local $dData = InetRead('https://www.websit.com/news.txt')
    If @error Then ConsoleWrite('Error: InetRead - ' & @error & @CRLF)
    Local $sData = BinaryToString($dData)
    Local $iDelete = FileDelete(@ScriptDir & '\news.txt')
    Local $hFile = FileOpen(@ScriptDir & '\news.txt',3 )
    FileWrite($hFile, $sData)
    FileClose($hFile)
    Local $aArray = IniReadSection(@ScriptDir & '\news.txt', 'NEWS')
    If @error Then ConsoleWrite('Error: IniReadSection - ' & @error & @CRLF)

        For $i = 0 To UBound($aArray) - 1
            $previousJournalNews = GUICtrlRead($journalNews)

            If $aArray[$i][1] <> "" Then 
                GUICtrlSetData($journalNews, $aArray[$i][1]  & @CRLF, 0)
            EndIf 
    Next

EndFunc

 

But when i show in my soft i show this :

image.png.f3c9c7c2cedf0496945e56451267c896.png

Why please, i have up my ISN autoit to latest version and autoit too.

 

THX

Link to comment
Share on other sites

OK

I have this now :

Local $dData = InetRead('https://www.site.com/testUTF8.txt', 1)
    If @error Then ConsoleWrite('Error: InetRead - ' & @error & @CRLF)
    Local $sData = BinaryToString($dData, 4)
    Local $iDelete = FileDelete(@ScriptDir & '\news.txt')
    Local $hFile = FileOpen(@ScriptDir & '\news.txt', 259)
    FileWrite($hFile, $sData)
    FileClose($hFile)
    Local $aArray = IniReadSection(@ScriptDir & '\news.txt', 'NEWS')
    If @error Then ConsoleWrite('Error: IniReadSection - ' & @error & @CRLF)

        For $i = 0 To UBound($aArray) - 1
            $previousJournalNews = GUICtrlRead($journalNews)

            If $aArray[$i][1] <> "" Then 
                GUICtrlSetData($journalNews, $aArray[$i][1]  & @CRLF, 0)
            EndIf 
    Next

 

My file is good if i show on internet exploerer.

And file download is good.

 

But now any news appear in my soft.

$Group4 = GUICtrlCreateGroup("News", 288, 304, 241, 185)
    $journalNews = GUICtrlCreateEdit("", 296, 328, 225, 153, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY))

My txt file content :

[NEWS]
1=test é

 

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>

$hGUI = GUICreate('Example', 800, 600)
$Group4 = GUICtrlCreateGroup("News", 288, 304, 241, 185)
$journalNews = GUICtrlCreateEdit("", 296, 328, 225, 153, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY))
GUISetState(@SW_SHOW, $hGUI)

Local $aArray = IniReadSection(@ScriptDir & '\news.txt', 'NEWS')
If IsArray($aArray) Then
    GUICtrlSetData($journalNews, BinaryToString(StringToBinary($aArray[1][1]), 4))
EndIf

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

 

When the words fail... music speaks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...