ua-parser / uap-core

The regex file necessary to build language ports of Browserscope's user agent parser.
Other
752 stars 451 forks source link

OS varies depending on User-agent HTML encoding #569

Open wilskong opened 10 months ago

wilskong commented 10 months ago

When looking at the following user-agent:

Mozilla/5.0%20(Linux;%20Android%209.0;%20Build/PI)%20AppleWebKit/537.36%20(KHTML,%20like%20Gecko)%20Chrome/92.0.4515.0%20Safari/537.36%20CrKey/1.56.500000%20DeviceType/AndroidTV

The os.string is accurately recognized as "Chromecast 1.56.500000" and the os.family is recognized as "Chromecast". This string is currently encoded with HTML encoding which generally is replacing whitespaces with %20

When looking at the same user-agent but in a decoded format:

Mozilla/5.0 (Linux; Android 9.0; Build/PI) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.0 Safari/537.36 CrKey/1.56.500000 DeviceType/AndroidTV

The os.string is instead read as "Android 9.0.0" and the os.family returned is "Android". The two should be in sync at the least where it should return "Chromecast"