Issue to update segment name with extended char like 'éçà'
Closed this issue · 4 comments
Hi,
When I try to update segment name using character as 'é', this causes to be converted to their Unicode escape sequences (\u00e9).
This is value I want to put into segment name :
data = {"seg": [{"id": 0, "n": "été"}]}
Which result into :
"n": "\u00e9t\u00e9"
Simple code :
from wled import WLED
import asyncio
async def main() -> None:
"""Show example on controlling your WLED device."""
async with WLED("192.168.1.125") as led:
await led.request('/json/state', method='POST', data={"seg": [{"id": 0, "n": "été", "fx": 53}]})
if __name__ == "__main__":
asyncio.run(main())
To solve this issue, code need to be modified into wled.py (line 182) like this :
# If updating the state, always request for a state response
if method == "POST" and uri == "/json/state" and data is not None:
import json
data["v"] = True
data = json.dumps(data, ensure_ascii=False) # Prevents Unicode escaping
try:
async with asyncio.timeout(self.request_timeout):
response = await self.session.request(
method,
url,
data=data,
headers=headers,
)
to prevent escaping
data = json.dumps(data, ensure_ascii=False) # Prevents Unicode escaping
instead json=data
data=data,
Have seen that you use orjson, do not know if got similar.
Maybe there is another way,
Let me know,
thanks
There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!
Still the same.
There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!
There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!