Jump to content

Recommended Posts

Posted

This function does not appear to be returning the correct characters for a site, but the code of the page of the site shows the right characters? Can someone show me how to correct this, or is this a bug in the function? Actually I corrected it in my code, but just replacing these characters, but should they even be part of the string?

Here is the two strange characters:
“
.â€.

 

#include <Inet.au3>
#include <String.au3>

$linc = "http://www.dictionary.com/browse/diablo?s=t"

$str = _INetGetSource($linc, 1)
; has this in it ;“devil.”.
$str = BinaryToString($str)
ConsoleWrite($str)
$str = _StringBetween($str, '<div class="def-set">', '</div>', 1)
MsgBox('', 'raw data', $str[0])

 

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Posted
23 minutes ago, AutoBert said:

as you use Inetget with param $BString = True Delete line #7

 

Sorry that was trying both, the first time I had a 0 in there, as I tried both to remove the special characters that are appearing...

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Posted

Given that the website explicitely declares that: "charset=utf-8", I'd use "$str = BinaryToString($str, $SB_UTF8)". But then the ConsoleWrite won't display everything as they are (MsgBox will).

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
52 minutes ago, jchd said:

Given that the website explicitely declares that: "charset=utf-8", I'd use "$str = BinaryToString($str, $SB_UTF8)". But then the ConsoleWrite won't display everything as they are (MsgBox will).

Thanks, that did the trick.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Posted (edited)

Both works:

  • Inetget reading binary:
#include <Inet.au3>
#include <String.au3>

$linc = "http://www.dictionary.com/browse/diablo?s=t"

$str = _INetGetSource($linc, 0)
$str = BinaryToString($str, $SB_UTF8)
FileWrite('Test.txt',$str)
$str = _StringBetween($str, '<div class="def-set">', '</div>', 1)
MsgBox('', 'raw data', $str[0])
ShellExecute('test.txt')
  • InetGet reading text: 
    #include <Inet.au3>
    #include <String.au3>
    
    $linc = "http://www.dictionary.com/browse/diablo?s=t"
    
    $str = _INetGetSource($linc, 1)
    FileWrite('Test.txt',$str)
    $str = _StringBetween($str, '<div class="def-set">', '</div>', 1)
    MsgBox('', 'raw data', $str[0])
    ShellExecute('test.txt')

     

 

Edited by AutoBert
Posted
1 hour ago, AutoBert said:

Both works:

  • Inetget reading binary:
#include <Inet.au3>
#include <String.au3>

$linc = "http://www.dictionary.com/browse/diablo?s=t"

$str = _INetGetSource($linc, 0)
$str = BinaryToString($str, $SB_UTF8)
FileWrite('Test.txt',$str)
$str = _StringBetween($str, '<div class="def-set">', '</div>', 1)
MsgBox('', 'raw data', $str[0])
ShellExecute('test.txt')
  • InetGet reading text: 
    #include <Inet.au3>
    #include <String.au3>
    
    $linc = "http://www.dictionary.com/browse/diablo?s=t"
    
    $str = _INetGetSource($linc, 1)
    FileWrite('Test.txt',$str)
    $str = _StringBetween($str, '<div class="def-set">', '</div>', 1)
    MsgBox('', 'raw data', $str[0])
    ShellExecute('test.txt')

     

 

The second one gets the same thing as I stated in the OP - the strange characters.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

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...