It is currently December 5th, 2021, 2:01 am

™ in tooltiptext act strange

Help with creating, editing & fixing problems with skins
User avatar
Judian81
Posts: 122
Joined: May 6th, 2021, 2:57 pm

™ in tooltiptext act strange

Post by Judian81 »

hey hello rainmeter people,

i have used the name from a file i got.

ToolTipText="The Sims™ 4"

this is the problem i got.
tooltiptext.png
the name from the file that is correct is from fileview plugin.


a lua script to read from txt files is going mad. if there is a ™ in the file name. he can not open the file.
i have changed the filename and yes it can read now.
but in the txt file the path to the picture is there. but also there is ™ in the name. and then i get a strange output again.
You do not have the required permissions to view the files attached to this post.
windows 10
User avatar
death.crafter
Rainmeter Sage
Posts: 1205
Joined: April 24th, 2021, 8:13 pm

Re: ™ in tooltiptext act strange

Post by death.crafter »

Judian81 wrote: November 18th, 2021, 3:42 am hey hello rainmeter people,

i have used the name from a file i got.

ToolTipText="The Sims™ 4"

this is the problem i got.

tooltiptext.png

the name from the file that is correct is from fileview plugin.


a lua script to read from txt files is going mad. if there is a ™ in the file name. he can not open the file.
i have changed the filename and yes it can read now.
but in the txt file the path to the picture is there. but also there is ™ in the name. and then i get a strange output again.
I think your ini encoding is incorrect. See that it is UTF-16LE or unicode.
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 13516
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: ™ in tooltiptext act strange

Post by balala »

death.crafter wrote: November 18th, 2021, 9:26 am I think your ini encoding is incorrect. See that it is UTF-16LE or unicode.
I probably would agree with this, however looks weird to have a problem with the TooltipText option, but to have no with the Text option.
Judian81 wrote: November 18th, 2021, 3:42 am a lua script to read from txt files is going mad. if there is a ™ in the file name. he can not open the file.
i have changed the filename and yes it can read now.
but in the txt file the path to the picture is there. but also there is ™ in the name. and then i get a strange output again.
Not sure I can follow, however I definitely would check first the encoding of files. The .ini files, as well as the eventually included .inc files have to have UTF-16 LE encoding (UCS-2 LE BOM in Notepad++). It's not enough (if can be said so) to have those files encoded as UTF-8.
A few details about the encoding can be found here.
User avatar
Judian81
Posts: 122
Joined: May 6th, 2021, 2:57 pm

Re: ™ in tooltiptext act strange

Post by Judian81 »

death.crafter wrote: November 18th, 2021, 9:26 am I think your ini encoding is incorrect. See that it is UTF-16LE or unicode.
hmm. i changed all the .ini .inc .lua files to UTF-16LE. and now it is fine.
i did changed .bat file to UTF-16LE too. but that goos wrong so better leave it like it is normal. and that is UTF-8 in my case.
i do not understand what you mean with unicode? unicode is not in my list of options.

but still lua script gives me an error. he can not open a file if there is ™ in the string.

Code: Select all

function Initialize()
	sFileToRead = SELF:GetOption('FileToRead')
end

function Update()
	hReadingFile = io.open(sFileToRead)
	if not hReadingFile then
		print('LuaTextFile: unable to open file at ' .. sFileToRead)
		return
	end
	sAllText = hReadingFile:read("*all")
	sAllText = string.gsub(sAllText, "\t", "     ")
	io.close(hReadingFile)
	return tostring(sAllText)	
end
C:\Users\*\Documents\Rainmeter\Skins\OneClick\FolderView\Folder7\Temp\C\ProgramData\2Cool\The Sims™ 4.url.png.txt

what it should do is open the txt file and we get the path for the picture we want to use in the filebrowser skin.
windows 10
User avatar
Judian81
Posts: 122
Joined: May 6th, 2021, 2:57 pm

Re: ™ in tooltiptext act strange

Post by Judian81 »

balala wrote: November 18th, 2021, 11:34 am I probably would agree with this, however looks weird to have a problem with the TooltipText option, but to have no with the Text option.
Not sure I can follow, however I definitely would check first the encoding of files. The .ini files, as well as the eventually included .inc files have to have UTF-16 LE encoding (UCS-2 LE BOM in Notepad++). It's not enough (if can be said so) to have those files encoded as UTF-8.
A few details about the encoding can be found here.
thanks for commenting on my post. yes the UTF-16 LE works for me.

i had already looked on that page but did not realy understand it till now. the problem i got when i changed the UTF rainmeter got a hard crach. it was so bad i could not even open rainmeter because this skin was loaded automaticly so boom he goos.
had to change the folder name in skin path to get it up running again. if you wish i can reproduce the crach in question.
windows 10
User avatar
death.crafter
Rainmeter Sage
Posts: 1205
Joined: April 24th, 2021, 8:13 pm

Re: ™ in tooltiptext act strange

Post by death.crafter »

Judian81 wrote: November 18th, 2021, 11:39 am hmm. i changed all the .ini .inc .lua files to UTF-16LE. and now it is fine.
i did changed .bat file to UTF-16LE too. but that goos wrong so better leave it like it is normal. and that is UTF-8 in my case.
i do not understand what you mean with unicode? unicode is not in my list of options.

but still lua script gives me an error. he can not open a file if there is ™ in the string.
UTF-16 is short termed Unicode. LE is byte order mark.

Lua can't read Unicode characters, so it gives error, or wrong characters.
from the Realm of Death
User avatar
jsmorley
Developer
Posts: 22416
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ™ in tooltiptext act strange

Post by jsmorley »

death.crafter wrote: November 18th, 2021, 1:23 pm UTF-16 is short termed Unicode. LE is byte order mark.

Lua can't read Unicode characters, so it gives error, or wrong characters.
To be clear, the .lua file itself can and should be encoded as UTF-16 LE. Any external files you "read" or "write" using Lua should be UTF-8 or ANSI.
User avatar
death.crafter
Rainmeter Sage
Posts: 1205
Joined: April 24th, 2021, 8:13 pm

Re: ™ in tooltiptext act strange

Post by death.crafter »

jsmorley wrote: November 18th, 2021, 1:24 pm To be clear, the .lua file itself can and should be encoded as UTF-16 LE. Any external files you "read" or "write" using Lua should be UTF-8 or ANSI.
The funny thing is, you can use Unicode characters in Lua. I wonder if Lua 5.4 supports Unicode reading.

Btw, you should introduce a SKIN:ReadFile() option. It would be hella useful.
from the Realm of Death
User avatar
jsmorley
Developer
Posts: 22416
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ™ in tooltiptext act strange

Post by jsmorley »

death.crafter wrote: November 18th, 2021, 1:26 pm The funny thing is, you can use Unicode characters in Lua. I wonder if Lua 5.4 supports Unicode reading.

Btw, you should introduce a SKIN:ReadFile() option. It would be hella useful.
The .lua file itself is read by Rainmeter, not Lua, and will be just fine with Unicode characters in the script. What Lua can't do is deal with multi-byte characters or the UTF-16 LE BOM characters in external files you try to read or write with Lua.

https://docs.rainmeter.net/tips/unicode-in-rainmeter/

.ini, .inc and .lua files should all always be encoded as UTF-16 LE.
User avatar
Judian81
Posts: 122
Joined: May 6th, 2021, 2:57 pm

Re: ™ in tooltiptext act strange

Post by Judian81 »

death.crafter wrote: November 18th, 2021, 1:26 pm The funny thing is, you can use Unicode characters in Lua. I wonder if Lua 5.4 supports Unicode reading.

Btw, you should introduce a SKIN:ReadFile() option. It would be hella useful.
i used some code on this forum for handling files to extract. it works just fine. it is in c++.
and with the default settings i want to print ™ to the output to console. i have troubeles doing that.
i used fprint, wprint, cout, wcout. and it or breaks or do not show in console.

:lol:
windows 10