load data from .txt is kinad messed

Hello, im kinad new to AppleScript Studio & Xcode, and im trying to load some data from a txt file loacted ind my project folder to a NSScroolView but my words contain æøå. and each time i try to load the data the word like " hjælp " danish for help is showen as " hjElp" with some fancy crap ontop E.

and here is what i use to load data…

[added AppleScript Tags for ease of use – ACB]

set FileContent to (((path to home folder) & "rdiff-logs:local:" as text) & mydate & ":" & mytime & ".txt")
set FileContentTmp to FileContent as alias
set FileContentShow to read FileContentTmp
set contents of text view 1 of scroll view 1 of window 1 to FileContentShow

and i have tryed using this to, with same res

set line_1 to "test æ"
set line_2 to "test ø"
set line_3 to "test å"

set the_text to ""
set all_lines to {line_1, line_2, line_3}
repeat with i in all_lines
	set the_text to the_text & i & return
end repeat

tell text view 1 of scroll view 1 of window 1 to set contents to the_text

what the h… am i doing wrong :confused:

What version of Mac OS X are on? What language do you use on your system?

Hello, im using Leopard, and im from Denmark, so danish…

have you tried this?

set FileContentShow to read FileContentTmp as «class utf8»

Yes, and if i use that i can’t build :confused:

hmm - it should … I have tried it here and it loaded all scandinavian and german accents I tried.

an other way to load a UTF8 encoded text file into a text view was this:

call method "setString:" of myTextView with parameter (call method "stringWithContentsOfFile:encoding:error:" of class "NSString" with parameters {myFilePath, 4, null})

uhm must be doing something wrong, dont know the call method

here a simple demo project showing both solutions …


hope it helps :slight_smile:

Oh yeah, thx alot Dominik, got it now, finaly…