The macro: The user is presented in a dialog with the content of a string list. Every entry is paired up with a checkbox and the user chooses which entry he wants to see on the character sheet. The dialog forwards the formulardata and another macro (well it is the same macro with different parameters) combines the choosen string list entrys to one string which is encoded via encode() and stored in another property that is finally displayed in the character sheet.
The problem: I use Ubuntu 9.04 as my development system. There was no problem at all, but...
If I run the same macro under Windows 7 I get little squares instead of my umlaute (ä, ö, ü...). If I try to write [r: encode("ä")] I get an error message as expected - MapTool always send me errors, when I tried to write umlaute in my macros. Normally I use the HTML writing. Unfortunately the HTML writing is already translated, when the string list entrys are displayed in the form. Hence the form forwards the umlaute as one character that MapTool shouldn't want to work with. Apparently this doesn't kill my macro, when the umlaute are in a JSON-Object and are just replaced by the little squares.
What I don't understand is why my Ubuntu enviroment doesn't have this problem. It even encodes the umlaute to the appropriate writing, but when I use an umlaut in my macros it gives me the same error message as under Windows.
My question: I would greatly appreciate every advice how to bypass the umlaute and get my macro to work as intended. As a bonus I'm eager to know why Ubuntu doesn't create this problem at all.
My code
Code: Select all
name: Vorteile
content: Glück, Gutaussehend
Code: Select all
<!-- Checks whether the select dialog should be shown or evaluated. -->
[if(json.type(macro.args)!="OBJECT"), code:
{
<!-- If the macro is called from the character sheet macro.args whould be e.g. ["Vorteile"] -->
[h: ChoosenProperty = macro.args]
[dialog("selectPropertyContent", "width=250; height=500; temporary=1; input=1;"): {
<html>
<head>
<title>Select</title>
</head>
<body>
<form name="propertyForm" action="macro://nameOfThisMacro@Lib:macros/all/Impersonated?" method="json">
[h: Propertycontent = getProperty(ChoosenProperty)]
<p>
[count(listCount(Propertycontent), ""):
'<input type="checkbox" name="'+roll.count+'" value="'+listGet(Propertycontent, roll.count)+'" checked="checked">'+listGet(Propertycontent, roll.count)+'<br>'
]
</p>
<input type="submit" value="Change" name="[r: ChoosenProperty]">
</form>
</body>
</html>
}]
};
{
[h: mParameter = json.toStrProp(macro.args)]
[h: mNumberOfParameters = countStrProp(mParameter)]
[h: mChoosenProperty = indexKeyStrProp(mParameter, mNumberOfParameters-1)]
[h: output = ""]
[h, count(mNumberOfParameters-1): output = listAppend(output, indexValueStrProp(mParameter, roll.count))]
[h: output = encode(output)]
[h: setProperty(mChoosenProperty+"_Displaycache", output, currentToken())]
}]