It is currently March 28th, 2024, 3:51 pm

Rainmeter.ini UTF-16

Report bugs with the Rainmeter application and suggest features.
Post Reply
User avatar
mrsalogo
Posts: 6
Joined: July 28th, 2015, 5:12 pm
Contact:

Rainmeter.ini UTF-16

Post by mrsalogo »

Hi,
First i would like to say that I love the continued dedication the the future development of this program.

The issue I am having relates to the Rainmeter.ini's recent conversion to UTF-16. Lua is unable to read UTF-16 and thus it is impossible for scripts to read the Rainmeter.ini file anymore. This recent change has broken a large amount of my skins because they use scripts to check information from the Rainmeter.ini. I don't know if there is a way for me to fix my skins and I am worried for older skins that might have broken from this update as well. I know that the development team loves to retain backwards compatibility for older skins and this issue is notable.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rainmeter.ini UTF-16

Post by balala »

mrsalogo wrote:The issue I am having relates to the Rainmeter.ini's recent conversion to UTF-16. Lua is unable to read UTF-16 and thus it is impossible for scripts to read the Rainmeter.ini file anymore. This recent change has broken a large amount of my skins because they use scripts to check information from the Rainmeter.ini. I don't know if there is a way for me to fix my skins and I am worried for older skins that might have broken from this update as well. I know that the development team loves to retain backwards compatibility for older skins and this issue is notable.
What information would you like to read from Rainmeter.ini? Because if you want to know the loaded skins (configs), you should have to take a look here: https://forum.rainmeter.net/viewtopic.php?p=149595#p149595
User avatar
mrsalogo
Posts: 6
Joined: July 28th, 2015, 5:12 pm
Contact:

Re: Rainmeter.ini UTF-16

Post by mrsalogo »

balala wrote:What information would you like to read from Rainmeter.ini? Because if you want to know the loaded skins (configs), you should have to take a look here: https://forum.rainmeter.net/viewtopic.php?p=149595#p149595

While web parser is a solution, it still does not solve the problem for older skins that will not be updated. My main point is that it breaks backwards compatibility.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rainmeter.ini UTF-16

Post by balala »

mrsalogo wrote:While web parser is a solution, it still does not solve the problem for older skins that will not be updated. My main point is that it breaks backwards compatibility.
Yep, probably it doesn't. Those skins have to be rewritten, I think.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Rainmeter.ini UTF-16

Post by jsmorley »

If you use a measure like this in a skin:

Code: Select all

[MeasureINI]
Measure=WebParser
URL=file://#SETTINGSPATH#Rainmeter.ini
CodePage=1200
RegExp=(?siU)^(.*)$
StringIndex=1
UpdateRate=30
Then every 30 seconds the entirety of Rainmeter.ini will be read into the value of that measure, which you can then use in Lua as you like.

The rub is that this will only work on Rainmeter 4.2 r3088 or later, while for it to work on earlier versions of Rainmeter, you need to remove the CodePage=1200 from the measure. We are planning to "release" version 4.2 very soon, so that will become a non-issue moving forward. We strongly feel that this is going to be a good change, and one that will be well supported in Rainmeter 4.2 with new skins. We have some changes coming soon that will allow plugins to much more easily and robustly detect if a particular skin, or even a particular "variant" of a skin, is loaded. That is the most common reason to read Rainmeter.ini. If you are using Lua to read other information, like position, or draggable, or click-through or other settings for a skin, you can use WebParser.

However, as you correctly note, it is a backwards compatibility issue for older skins. We always regret that, and go to great lengths to avoid it, but we just can't in this case. We balanced the need to support languages other than English in Rainmeter.ini against what we believe is the relatively rare skin that reads Rainmeter.ini.

We are most uncomfortable with any backwards compatibility issue, no matter how rare or obscure, but this was an either-or decision. There is no possible middle ground. There is just no way to create something "new" and "deprecate" the old. We have chewed on it for a long time, and decided that we just can't continue to have Rainmeter hinder those who speak a language that uses multi-byte characters. It was time for Rainmeter to grow up and join the world.

My only real regret that that Lua has not, and likely never will, also grow up and allow UTF-16 LE. That is the real root of this problem. We probably should have baked in Python instead of Lua, but the relative simplicity of Lua for our users was an attraction.

One really minor, uber-geeky thing to keep in mind when using WebParser to get any file into Lua, is that when the data is received by Lua from Rainmeter, all end-of-line sequences are converted from Windows (\r\n) to the platform agnostic Linux (\n). Lua does this with any data stream or file it reads on Windows. This can cause some head-scratching if you are parsing a file and looking for line ends. The "carriage return" \r will not be there. If you write to a file from Lua on Windows, the standard Windows \r\n will be used when the file is written.
Post Reply