Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
317 มุมมอง

When upgrading a custom module to Odoo 19, I get the following error is odoo log:

ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.


I have removed the following line from the beginning of the XML files, but still have the same error:

<?xml version="1.0" encoding="utf-8" ?>


Note: I am upgrading from v15 to v19.

What is the fix to such error message?

อวตาร
ละทิ้ง

A piece of source code would be beneficial to your question's chance of being answered.

The upgrade scripts for Odoo 19 are not yet available except to Odoo Online database deployment and only for testing.

See https://upgrade.odoo.com/

คำตอบที่ดีที่สุด

Hi,


To fix this, ensure that all XML files start directly with <odoo> or <record> and do not include the line <?xml version="1.0" encoding="utf-8"?>. You should also check for invisible BOM characters, which are often added by text editors. Re-save the files using UTF-8 encoding without BOM, preferably in a clean editor like VS Code.


Finally, verify that all XML files listed in the module manifest (__manifest__.py) are properly encoded and do not contain unwanted characters or spaces before the <odoo> tag. Once all files are saved as UTF-8 without BOM, the error will be resolved.


Hope it helps

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello,

<?xml version="1.0" encoding="utf-8" ?>
 I found the space near question mark inside the tag.
Please try below:

<?xml version="1.0" encoding="utf-8"?>

อวตาร
ละทิ้ง

Not only did OP state he has removed that line, it's also not invalid XML either way.