creewick wrote: ↑March 22nd, 2022, 4:08 pm
UPD: Hi! I'm creating a to-do list skin. I attached the package in the comments below
Long story short, I'm passing
$UserInput$ from
InputText measure to a Lua function
The way Lua interprete this string is not the same as original input
I had tried different combinations of encodings, here are the results:
Case 1:
Scripts\Reminders.lua - UTF-8
Variables\Reminders.inc - UTF-16 LE
Input string: "

Привет!"
Lua string: "? Привет!"
String is not truncated, but all emojis are replaced with question marks
Case 2:
Scripts\Reminders.lua - UTF-16 LE
Variables\Reminders.inc - UTF-16 LE
Input string: "

Привет!"
Lua string: "

Пр�"
Emojis are dislaying correctly, but cyrillic text is getting truncated
Case 3:
Scripts\Reminders.lua - UTF-16 LE
Variables\Reminders.inc - UTF-8
Input string: "

Привет!"
Lua string: "? Пр?"
Emojis are replaced with question marks, and cyrillic text is getting truncated
Case 4:
Scripts\Reminders.lua - UTF-8
Variables\Reminders.inc - UTF-8
Input string: "

Привет!"
Lua string: "? Привет!"
String is not truncated, but all emojis are replaced with question marks
I believe this (or at least case 2 and the truncated text above) is related to the bug reported by Jax
here. You might want to try sending the emojis and the string separately to Lua (emojis as
escaped character variables, if possible) and do the needed conversion back to emojis in Lua, assuming the encoding properly displays the text. If this is even possible, that is.
Or, let Rainmeter properly set a variable with both the emoji and the text, then use
SKIN:ReplaceVariables('#VariableHoldingUserInput#') in Lua.
That being said, you should know that character variables above xFFFE are not supported by Rainmeter. Some "emojis" are beyong that limit.
EDIT: For example, setting the
Command1 option in
[NewItemInput] from
Medium.ini to:
Code: Select all
Command1=[!SetVariable NewItemInput "$UserInput$"][!Update][&Lua:addReminder('NewItemInput')][!Refresh]
and the
addReminder function in
Reminders.lua to:
Code: Select all
function addReminder(textvar)
local count = getRemindersCount()
SKIN:Bang('!WriteKeyValue', 'Variables', 'Item'..(count+1), SKIN:ReplaceVariables('#'..textvar..'#'), '#@#Variables/Reminders.inc')
return 0
end
will properly display, after converting the Lua file encoding to UCS2-LE BOM in Notepad++ (can't remember if it's UTF-8 or UTF-16 LE in the other notation, and won't bother to remember):
Reminders.jpg
As you can see, the
+ is properly displayed. Don't know about cyrillic text though, you'd have to try it for yourself, but I reckon it will work as well since the variable is taken from Rainmeter already set up properly.
You do not have the required permissions to view the files attached to this post.