NSCharacterConversionException in very simple code

The following code is causing a NSCharacterConversionException:

set txtTest1 to "설치 완료"
set txtTest2 to txtTest1

Log A
if txtTest1 is not equal to txtTest2 then
    Log B
end if
Log C

The exact error thrown is:
NSCharacterConversionException Conversion to encoding 30 failed for string “설치 완료”

This happens on most [all?] non-ASCII characters.

I have only started seeing this error in the past few days, on code that has been working for months.

Has there been an update to OSX or Eggplant that has introduced this problem?



Thanks for pointing out this bug. It will be fixed for the next release of Eggplant. We apologize for the inconvenience.

I don’t know why you would just be seeing this recently. Nothing has changed with Eggplant, and it appears that the problem has been present for quite some time.

Unfortunately, I don’t see any easy way to work around this particular problem. In the not-so-easy workaround category, here’s a function you can call to compare two strings that may contain non-ASCII characters:

function stringsAreEqual str1, str2
	if the length of str1 is not the length of str2 then return false
	repeat with n=1 to the length of str1
		if charToNum(char n of str1) is not charToNum(char n of str2)
		then return false
	end repeat
	return true
end stringsAreEqual

Then replace your test with:

if not stringsAreEqual(txtTest1, txtTest2) then
    Log B 
end if 

Hopefully this will help you to get by until the fix can be released.