[Quark8] Importing and exporting xpress tags

Hi,

I’ve a xpress tag file with latin text. When I change the text contents to another latin language, I can import the text with no problems. But when I insert the xpress tag file in a cyrillic language it goes wrong with applescript but manually it works good.

Here is an example code:

After the run the text looks bad in Quark but when importing it manually it looks good. Is there a way that I can import this file just like I manually do? And I don’t mean GUI Scripting

set AppleScript's text item delimiters to ""
set theFile to ((path to desktop folder) & "xpresstagfile.xtg" as string)
tell application "QuarkXPress"
    save story 1 of document 1 as "Xpress tags" in file theFile encoding "Unicode (UTF-8)"
    if not my findAndReplace(theFile) then
        return false
    end if
    set story 1 of document 1 to file theFile
end tell

on findAndReplace(theFile)
    try
        set fd to open for access file theFile
        set theContents to read fd as «class utf8»
        close access fd
    on error errmsg
        display dialog errmsg
        close access file theFile
        return false
    end try
    set theContents to theContents as Unicode text
    set theContents to replaceString(theContents, "StrickJacke" as Unicode text, "Вязаная кофта" as Unicode text)
    set theContents to theContents as «class utf8»
    try
        set fd to open for access theFile with write permission
        set eof of fd to 0
        write theContents to fd as «class utf8»
        close access fd
    on error
        close access file theFile
        return false
    end try
    return true
end findAndReplace

on replaceString(theString, oldSubString, newSubString)
    set AppleScript's text item delimiters to oldSubString
    set theTextItems to every text item of theString
    set AppleScript's text item delimiters to newSubString
    set newString to theTextItems as Unicode text
    set AppleScript's text item delimiters to ""
    return newString
end replaceString