Jump to content

Click My UTF8 ANSI QuizTest


ANSI UTF8 FileOpen  

1 member has voted

  1. 1. Will this work better in the future?

    • yes
      0
    • no
      1


Recommended Posts

This script should run when clicked. Tested & should work on Win7 & XP. That said, I banged it out in notepad on another machine for the net upload. This is the chopped down script. Please Help.

; QuizTest cut down a bit
#include<File.au3>
#include<array.au3>
#include<string.au3>
Global $partfile, $line, $filepath, $aRecords

$fopend = FileOpenDialog("Select Sections.txt", @ScriptDir, "ANSI Text files (*.txt)")
    If Not _FileReadToArray($fopend, $partfile Then
        Exit
    EndIf

_ArrayDelete($partfile, 0)
$sectioname = $partfile[1] ; Splash Screen
$startreadline = $partfile[2] ; Read line what
$stopreadline = $partfile[3] ; to line what

$fromansi = $partfile[0]
; curntfile = FileOpen( $fromansi, $FO_UTF8_NOBOM ) ; This removes the í
curntfile = FileOpen( $fromansi, $FO_ANSI ) ; This doesnt work

    $x = startreadline
    Do
        $line = FileReadLine($curntfile, $x) & @LF & $line ; string2array for sections-lines
        If @error = -1 Then ExitLoop
        $x = $x+1
    Until $x = $stopreadline
    FileClose($curntfile)

    $aRecords = _StringExplode($line, @LF, 0)
    For $x = 1 To $aRecords ; goes to whatever count
    Next
    $size = Ubound($aRecords)
    _ArrayReverse($aRecords) ; Upside Down/Rightside Up
    $aRecords[0] $size ; ut the total UBound size

    $file = $aRecords[3]
    
    $filepath = @ScriptDir & "\NOTANSI" & ".htm" ; QuestionFile
    FileWrite($filepath, "shat UTF8 " & $file)

    ShellExecute("NOTANSI.htm", "", @ScriptDir, "")

#cs
;each of these ansi files have four lines; did them in pspad
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
questions.txt:
--_start_--
ANSIQuestion-0001
nín hǎo | Not <NOBR>&#0237;</NOBR> == í
Hello (formal)
EmptyLine
--_end_--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sections.txt:
--_start_--
questions.txt
ANSI Quiz From This ANSI FILE
0
4
EmptyLine
--_end_--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#cs

I get  &#0195; Ã instead of &#0237; í once it goes Unicode on me.
this is pretty standard across Windows US keyboarding
there are also others that are standardly transcoded badly
I recently wrote this, the only thing I've really programmed, & it broke recently with the AutoIt release.  This code break makes all my other files a hassle & it will take forever to do the FileWrites over.  How do you do them?  I don't even know where to start.  I need the .htm .txt's in ANSI.  Is there a faster way than back&forth-ing them from &#ansi to Unicode.  It runs slow enough already.

Click&Go ANSI UTF8 $FileOpen QuizTest

QuizTest_ANSI_UTF8.txt

Edited by MaxPlankpar
Link to comment
Share on other sites

nÃn hǎo

nín h&#0462;o

nín hǎo
nÃn h&#0462;o | Not &#0237; == í

 


BinaryToString for unsupported language. [Solved]
https://www.autoitscript.com/forum/topic/181968-binarytostring-for-unsupported-language-solved/

Unicode stringToBinary for unsupported language
https://www.autoitscript.com/forum/topic/182255-unicode-stringtobinary-for-unsupported-language/

Edited by MaxPlankpar
not needed/ superfluffous / Delete
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...