ActiveWindow name parsing issue

Picture says 1000 words Not really sure what's going on at the moment with all the parsing issuing
No description
Solution:
2.1.0
Jump to solution
50 Replies
HASS.Agent Helper
Help us Help Others!
To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution
From An unknown user
HASS.Agent Helper
Help us Help You!
Please don't delete messages or posts because it makes it impossible to understand what happened. If you don't want your messages to be seen then don't post here. Make sure to provide detailed reports of bugs.
Please include error log uploads and info about the bug.
Evostance
EvostanceOP11mo ago
Call of Duty® HQ - Call of Duty® HQ - C?a?l?l? ?o?f? ?D?u?t?y?®? ?H?Q????????????????????????????????????????????????????????????????????????????????????????? - C?a?l?l? ?o?f? ?D?u?t?y?®? ?H?Q???????????????????????????????????????????????????????????????????????????????????????????????? - ?C?a?l?l? ?o?f? ?D?u?t?y?®? ?H?Q?????????????????????????????????????????????????????????????????????????????????????????? Discord - This server in off-topic - #??·off-topic | HASS.Agent - Discord
DrR0x
DrR0x11mo ago
That's because of the actual windows not because of Hass.agent The discord server uses an emoji for that channels that hass.agent doesn't parse and gets ?? So similar thing for call of duty I reckon whitespace chars are getting added But considering it was okay one time for CoD maybe @Amadeo knows why it's doing that
Amadeo
Amadeo11mo ago
HASS.Agent is just grabing the info from the windows but there may be some encoding shenanigans going on I don't have new CODs (and ain't gonna get one xD) so won't test on that but I can test with the discord looks about right on windows itself
DrR0x
DrR0x11mo ago
You sure you don't want 200+ GB of game files?
Amadeo
Amadeo11mo ago
don't get me started xD
DrR0x
DrR0x11mo ago
Yeah but I've had this issue before I'm pretty sure. It's because windows backend uses a different fontface to the one chosen by you for your UI. It's really dumb. When I made a python script it used to do this. I just had to filter out the question marks
Amadeo
Amadeo11mo ago
reproduced at least 😄
Amadeo
Amadeo11mo ago
now it makes me wonder, what kind of bullshittery does cod do with the window name that it has so many "?"
DrR0x
DrR0x11mo ago
?, is there something in the code I'm missing 😂
Amadeo
Amadeo11mo ago
it just grabs the text not even trying the decoding + it grabs is from the user32.dll (not visible on sc) but there is another issue
Amadeo
Amadeo11mo ago
even the debbuger gets "??" google it is then
DrR0x
DrR0x11mo ago
😂 Maybe windows uses some non standard encoding for its UI? And visual studio uses something else? Makes no sense to me Oh wait no @Amadeo , it is being converted to ? When you do .toString() right?
Amadeo
Amadeo11mo ago
yesn't string can be encoded in various formats utf-8, unicode'n'shit
DrR0x
DrR0x11mo ago
Does that method support all of them 😂
Amadeo
Amadeo11mo ago
yesn't 2 😄
DrR0x
DrR0x11mo ago
Doesn't support m$?😂
Amadeo
Amadeo11mo ago
deducing the encoding is another science by itself at least in my head
DrR0x
DrR0x11mo ago
Nah there's a tool for that surely Just copy paste the buffer and send it here and we could find something
Amadeo
Amadeo11mo ago
if you have "bytes" it's not so easy to deduce it since there is no marker or anything how they are encoded
DrR0x
DrR0x11mo ago
M$ docs aren't exactly helpful
Amadeo
Amadeo11mo ago
fixed it tho
DrR0x
DrR0x11mo ago
In what bit did you change the encoding 😂 is that not passed to the toString method?
Amadeo
Amadeo11mo ago
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
DrR0x
DrR0x11mo ago
Ohh you are actually important the dll Okay
Amadeo
Amadeo11mo ago
the charset thingy was the fix
DrR0x
DrR0x11mo ago
Auto exists!? Where has it been my entire life
Amadeo
Amadeo11mo ago
lol
DrR0x
DrR0x11mo ago
I doubt it's in python tho 😭
Amadeo
Amadeo11mo ago
most likely auto = current system one xD but it's a guess
DrR0x
DrR0x11mo ago
Good point So 2.0.somethinf or you going to add this one to the 2.1.0?
Solution
Amadeo
Amadeo11mo ago
2.1.0
Amadeo
Amadeo11mo ago
since the beta1 will be "this week(TM)" 😄
DrR0x
DrR0x11mo ago
👍
Amadeo
Amadeo11mo ago
now, does anyone remember max payload for HA? the current implementation retrieves only 256 chars, we can do better than this
Amadeo
Amadeo11mo ago
Home Assistant Community
Large payload in MQTT sensor
Dear All, I am trying to display a list of dhcp clients from my router. The list of clients is coming in an MQTT message in a payload in the following format (this is an actual sample, made shorter): [ { "field1": "1648269597", "field2": "50:02:91:65:ac:a8", "field3": "192.168.1.103", "field4": "officedoor-3240", "field5"...
Amadeo
Amadeo11mo ago
nvm looks like I need to decrease it to 255 to make it future proof lol here are good intentions for you
DrR0x
DrR0x11mo ago
Surely we don't hit 255 😂
Amadeo
Amadeo11mo ago
apparently windows can handle even more #todayILearned @Evostance do you have a github handle?
Amadeo
Amadeo11mo ago
GitHub
Fix: active window title encoding by amadeo-alex · Pull Request #50...
This PR fixes window title sensor encoding issue reported by Evostance. Before: After: In addition, changes were made to ensure the window title length sent to HA will not exceed 255 characters -...
Evostance
EvostanceOP11mo ago
Yeah it's just greghesp I'll have a look when I'm back on my pc
Amadeo
Amadeo11mo ago
I'll edit the PR once home 😄
Want results from more Discord servers?
Add your server