Jump to content

Recommended Posts

Posted (edited)

Please help me with very strange problem.

I have a function that return a table from IE.

In this table i have attachment names.

What do this funtion is download the attachment and check that attachment exists on the disk.

Simple i check with fileexist function.

unfortunately, despite the fact that the downloaded file is in the directory, the function returns that it is missing.

Path looks ok, file exists, function return that file not exists 😕

It is interesting that when I enter the path manually it works!

$plik1 = "C:\Users\Zmylna\Downloads\Bez tytuÅ‚u20200424033430215.jpg"   ;<<<< string returned by my fuction - Not working
$plik2 = "C:\Users\Zmylna\Downloads\Bez tytuÅ‚u20200424033430215.jpg"   ; string manualy written in scite for test - Working

$A = StringCompare($plik1, $plik2)
MsgBox(0, "", $A)
; Function returns -1

If $plik1 = $plik2 Then
    MsgBox(0, "", "Strings are equal")
Else
    MsgBox(0, "", "Strings are not equal")
EndIf
;If returns "Strings are not equal"

ConsoleWrite($plik1 & @CRLF)
ConsoleWrite($plik2 & @CRLF)

; Console write output:
;C:\Users\Zmylna\Downloads\Bez tytu³u20200424033430215.jpg
;C:\Users\Zmylna\Downloads\Bez tytu³u20200424033430215.jpg

Sorry for my english.

test.au3

Edited by Zmylna
  • Developers
Posted

As I expected, the hex values for both is different.

When we take this part of the filename: Bez tytuÅ
Then the hex for the first line is :     42657A2074797475C5
and the hex for the second line is : 42657AC2A074797475C5

So you see the different hex values in red for the "same character"?

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 (edited)

What codepage do you use in SciTE ? To process Unicode characters :

# Unicode
#code.page=65001
code.page=0

code.page=65001 should be activated in the SciTE configuration.

Edit @Zmylna :

You can alternatively add

code.page=65001
output.code.page=65001

to the SciTEUser.properties

Edited by Musashi
Posted
1 minute ago, Jos said:

As I expected, the hex values for both is different.

When we take this part of the filename: Bez tytuÅ
Then the hex for the first line is :     42657A2074797475C5
and the hex for the second line is : 42657AC2A074797475C5

So you see the different hex values in red for the "same character"?

Jos

Yes i see. I didn't think to check it this way 😕

How to deal with it in an elegant way?

Posted (edited)
5 minutes ago, Musashi said:

What codepage do you use in SciTE ? To process Unicode characters :

# Unicode
#code.page=65001
code.page=0

code.page=65001 should be activated in the SciTE configurationentered in the SciTE configuration.

Now i have code.page=0

I will change to 65001 and check if it is ok

-----edit----

Still the same problem with string compare

Only console output looks different

Edited by Zmylna
Posted

After  "BEZ" you have a white space (0x20) in the first string and an unbreakable space (0xA0) in the second string.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Posted
$new_string = ""

For $n = 1 To StringLen($plik2)
    $char = StringMid($plik2, $n, 1)
    $char_hex = _StringToHex($char)
    $new_string = $new_string & _HexToString($char_hex)
Next

$plik1 = $new_string

In this way both strings are the same.

Thanx all for your help :)

  • Zmylna changed the title to String - very strange problem (SOLVED)

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
×
×
  • Create New...