From Roger.Strandberg at seb.se Thu Jul 2 10:04:45 2026 From: Roger.Strandberg at seb.se (Roger.Strandberg@seb.se) Date: Fri Jul 3 08:58:57 2026 Subject: [xsde-users] XSD/e validates string length using byte count (strlen/.size()), not Unicode character count Message-ID: Hi All, We have encountered that in ISO20022 and PACS008 the nm tag is 140 characters and using Polish ? and ? , those get counted as 2 chars. * ? (U+00F3) = 2 bytes * ? (U+0142) = 2 bytes XSD: As I see it this is a bug in string-common.cxx as it uses size_t n = str.size(); and not Unicode character count. Should not XSD/e use something like: size_t n = 0; for (size_t i = 0; i < str.size(); ) { unsigned char c = str[i]; if (c < 0x80) i += 1; else if ((c & 0xE0) == 0xC0) i += 2; else if ((c & 0xF0) == 0xE0) i += 3; else i += 4; ++n; } Best Regards Roger Strandberg Techdev, International Systems 1 Technology SEB Mobile: +46 70 7760785 Postal Address: SE-106 40 Stockholm Office Address: Stj?rntorget 4 E-mail: roger.strandberg@@seb.se sebgroup.com Invoice address: Skandinaviska Enskilda Banken AB, Accounts Payable, SE-106 40 Stockholm Please consider the environment before printing this e-mail CONFIDENTIALITY NOTICE This e-mail is confidential and may contain legally privileged information. If you have received it by mistake, please inform us by reply e-mail and then delete it (including any attachments) from your system; you should not copy it or in any other way disclose its content to anyone. E-mail is susceptible to data corruption, interception, unauthorized amendment, tampering and virus. We do not accept liability for any such actions or the consequences thereof. From boris at codesynthesis.com Mon Jul 6 08:32:02 2026 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jul 6 08:32:16 2026 Subject: [xsde-users] XSD/e validates string length using byte count (strlen/.size()), not Unicode character count In-Reply-To: References: Message-ID: Hi Roger, Thanks for the report. I think you are right, this is a bug and I've filed it here: https://github.com/codesynthesis-com/xsde/issues/2 Will aim to fix for the next release of XSD/e. Best regards, Boris