Howdy Andrew There’s a few things to deal with here.
- you need to know your database encoding (let’s assume UTF-8) - you need to get values out of your database in a way that gives you the binary data rather than strings that the engine has assumed were in native encoding. Use: local tCursor put "SELECT * FROM promosRedeemed" into tSql put revQueryDatabase(sDbId, tSql) into tCursor local tResults repeat until revQueryIsAtEnd(tCursor) repeat for each item tColumn in revDatabaseColumnNames(tCursor) local tValue get revDatabaseColumnNamed(tCursor, tColumn, “tValue”) put textDecode(tValue,”UTF-8”) into tValue replace return with “ -=- “ in tValue // ACCOUNTS FOR LINE BREAKS IN DATA put tValue & tab after tResults end repeat put return into the last char of tResults revMoveToNextRecord tCursor end repeat revCloseCursor tCursor - you need to write this file in an encoding you know so you can decode it when you download: put "redemption-log_" & the seconds & ".txt" into tFileName put textEncode(tResults, “UTF-8”) into url (“binfile:” & specialFolderPath("home") & "/public_html/server/apps/iot/logs/" & tFileName) - you need to read the file and decode from the encoding you know it is in: put textDecode(url (“binfile:” & <local path>), “UTF-8”) into tResults Disclaimer: this code has just been written into an email client untested so may have some errors. Cheers Monte _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode