Jump to content

Recommended Posts

Posted (edited)

I have problem with å ä ö Å Ä Ö  and I use AutoIt ver 3.3.14.1 please see my attaced zip file with file mall.htm..

What I am doing wrong thats works ok with older Autoit ..

; Autoit version 3.3.14.1


$dat = @YEAR & "-" & @MON & "-" & @MDAY & " - " & "  " & @HOUR & ":" & @MIN
$namn = "Unicode problem's"

$Test1 = " Test1 = Å Ä Ö"; should be Test1 = Å Ä Ö

$test2 = "Test2 = å ä ö" ; Should be Test2 = å ä ö

$dag = "Måndag Lördag Söndag" ; Should be Måndag, Lördag Söndag

    $filein = FileOpen("mall.htm", 0)
    $fileout = FileOpen("Result.htm", 2)


    While 1
        $line = FileReadLine($filein)
        If @error = -1 Then ExitLoop
        If StringInStr($line, "%N") Then
            $line1 = StringReplace($line, "%N", $namn)
            FileWriteLine($fileout, $line1)
        ElseIf StringInStr($line, "%Dag") Then
            $line1 = StringReplace($line, "%Dag", $dag)
            FileWriteLine($fileout, $line1)
        ElseIf StringInStr($line, "%Dat") Then
            $line1 = StringReplace($line, "%Dat", $dat)
            FileWriteLine($fileout, $line1)
        ElseIf StringInStr($line, "%Test1") Then
            $line1 = StringReplace($line, "%Test1", $Test1)
            FileWriteLine($fileout, $line1)
        ElseIf StringInStr($line, "%Test2") Then
            $line1 = StringReplace($line, "%Test2", $Test2)
            FileWriteLine($fileout, $line1)
        Else
            FileWriteLine($fileout, $line)
        EndIf
    WEnd
    FileClose($filein)
    FileClose($fileout)

 

AutoIt.zipFetching info...

Edited by Borje
Posted (edited)

What should I get ?

Here are my results:

Unicode problem's
ĺ ä ö Måndag Lördag Söndag
2021-04-26 - 14:15
Ĺ Ä Ö Test1 = Å Ä Ö
ĺ ä ö Test2 = å ä ö
Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 4/26/2021 at 12:23 PM, Borje said:

here I have anoter result see file result

Expand  

as far as I understand ... I see the same result:

Unicode problem's
å ä ö Måndag Lördag Söndag
2021-04-26 - 13:09
Å Ä Ö Test1 = Å Ä Ö
å ä ö Test2 = å ä ö

Or I miss something ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

In SciTE4Au3 check in menu "FILE / Encoding" ... What you have selected there ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
  On 4/26/2021 at 12:28 PM, Borje said:

it works good in 3.3.12.0

Expand  

3.3.12.x has a different way to check script/file encoding.

try to add this first line:
 

#   " Test1 = Å Ä Ö" ; should be Test1 = Å Ä Ö
#include <FileConstants.au3>
.......

at the top of your script

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Eventually:

Global Const $_DUMMY_FAKE_FIX = " Test1 = Å Ä Ö" ; should be Test1 = Å Ä Ö
#include <FileConstants.au3>
.......

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 4/26/2021 at 12:32 PM, Borje said:

I use Code page property

Expand  

I use UTF-8

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 4/26/2021 at 12:37 PM, Borje said:

It' same problem

Expand  

Which one of the proposed soultion you checked ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

So we must wait fo more competent helpers, because I give up ;)

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I don't think the problem is in AutoIT version, try the following script:

Global $dat = @YEAR & "-" & @MON & "-" & @MDAY & " - " & "  " & @HOUR & ":" & @MIN
Global $namn = "Unicode problem's"

Global $Test1 = " Test1 = Å Ä Ö" ; should be Test1 = Å Ä Ö

Global $test2 = "Test2 = å ä ö" ; Should be Test2 = å ä ö

Global $dag = "Måndag Lördag Söndag" ; Should be Måndag, Lördag Söndag

Global $sInputFile = @ScriptDir & "\Mall.htm"
Global $sOutputFile = @ScriptDir & "\Result.htm"
_Write_Example_HTML($sInputFile)  ; Write the example file!

Global $hFileIN = FileOpen($sInputFile, 0 + 16384) ;  $FO_FULLFILE_DETECT (16384)
Global $hFileOUT = FileOpen($sOutputFile, 2 + 16384) ; $FO_OVERWRITE (2)


While 1
    Local $line = FileReadLine($hFileIN)
    If @error = -1 Then ExitLoop
    If StringInStr($line, "%N") Then
        $line1 = StringReplace($line, "%N", $namn)
        FileWriteLine($hFileOUT, $line1)
    ElseIf StringInStr($line, "%Dag") Then
        $line1 = StringReplace($line, "%Dag", $dag)
        FileWriteLine($hFileOUT, $line1)
    ElseIf StringInStr($line, "%Dat") Then
        $line1 = StringReplace($line, "%Dat", $dat)
        FileWriteLine($hFileOUT, $line1)
    ElseIf StringInStr($line, "%Test1") Then
        $line1 = StringReplace($line, "%Test1", $Test1)
        FileWriteLine($hFileOUT, $line1)
    ElseIf StringInStr($line, "%Test2") Then
        $line1 = StringReplace($line, "%Test2", $test2)
        FileWriteLine($hFileOUT, $line1)
    Else
        FileWriteLine($hFileOUT, $line)
    EndIf
WEnd
FileClose($hFileIN)
FileClose($hFileOUT)
ShellExecute($sInputFile)
ShellExecute($sOutputFile)
ConsoleWrite("- FileGetEncoding   Input File: " & $sInputFile & @CRLF & '->' & _FileGetEncoding($sInputFile) & @CRLF)
ConsoleWrite("- FileGetEncoding  Output File: " & $sOutputFile & @CRLF & '->' & _FileGetEncoding($sOutputFile) & @CRLF)

Func _Write_Example_HTML($inputFilePath = "eg.htm")
    Local $iHTMLcontent = '<!DOCTYPE html>' & @CRLF & '<html>' & @CRLF & '<head>' & @CRLF & '<meta charset="UTF-8">' & @CRLF & '<title></title>' & @CRLF & '</head>' & @CRLF & '<table cellpadding=5 cellspacing=5 border=2 bordercolor=#666666 bgcolor="#C0C0C0">' & @CRLF & '<tr>' & @CRLF & '<td align=center colspan="2" bgcolor="#33CCCC">' & @CRLF & '<b>' & @CRLF & '<font size="5">%N</font><br>' & @CRLF & '<font color=#000080</font>' & @CRLF & '</b>' & @CRLF & '</td>' & @CRLF & '</tr>' & @CRLF & '<tr>' & @CRLF & '<td align=center bgcolor="#E41B17">' & @CRLF & '<b><font size="3" color="#FFFFFF">  å ä ö</font><br>' & @CRLF & '<b><font size="3" color="#FFFFFF"></font></b>' & @CRLF & '</td>' & @CRLF & '<td align=center bgcolor="#E41B17">' & @CRLF & '<b><font size="3" color="#FFFFFF"' & @CRLF & '<font color="#FFFFFF">%Dag</font><br>' & @CRLF & '<font color="#FFFFFF">%Dat</font>' & @CRLF & '</td>' & @CRLF & '</tr>' & @CRLF & '<tr>' & @CRLF & '<td align=right bgcolor="#33CCCC"color="#FFFFFF">Å Ä Ö</td>' & @CRLF & '<td align=left bgcolor="#33CCCC">' & @CRLF & '<font color="#000000">%Test1</font>' & @CRLF & '</tr>' & @CRLF & '<tr>' & @CRLF & '<td align=right bgcolor="#33CCCC">å ä ö</td>' & @CRLF & '<td align=left bgcolor="#33CCCC">' & @CRLF & '<font color="#000000">%Test2</font>' & @CRLF & '</tr>' & @CRLF & '<tr>' & @CRLF & '</table>' & @CRLF & '</body>' & @CRLF & '</html>'
    Local $hOpen = FileOpen($inputFilePath, 2 + 16384) ;  $FO_FULLFILE_DETECT (16384)  ; $FO_OVERWRITE (2)
    FileWrite($hOpen, $iHTMLcontent)
    Return (FileExists($inputFilePath) And FileClose($hOpen) > 0)
EndFunc   ;==>_Write_Example_HTML

Func _FileGetEncoding($iFile)
    Local $Encoding = FileGetEncoding($iFile)
    If ($Encoding = 32) Or ($Encoding = 1024) Then Return "[32] UTF16 Little Endian"
    If ($Encoding = 64) Or ($Encoding = 2048) Then Return "[64] UTF16 Big Endian."
    If ($Encoding = 128) Then Return "[128] UTF8 (with BOM)."
    If ($Encoding = 256) Then Return "[256] UTF8 (without BOM)."
    Return "[512] ANSI"
EndFunc   ;==>_FileGetEncoding

 

Regards,
 

Posted

I'm still not sure where the problem is.

Show proper and incorrect results.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Developers
Posted

The Result.htm file is missing in the zip so there is no way to verify what you get and compare that.
Please supply a complete set of files and also so me the Console Output of SciTE when you run your script.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted
  On 4/26/2021 at 2:00 PM, Jos said:

The Result.htm file is missing in the zip so there is no way to verify what you get and compare that.
Please supply a complete set of files and also so me the Console Output of SciTE when you run your script.

Jos

Expand  

Result.htm is a new file to be burned, not an existing file!

 

Regards,
 

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
  • Recently Browsing   0 members

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