The meaning of nuc_length and uc_length parameters in PyRFC?

后端 未结 1 328
迷失自我
迷失自我 2021-01-28 01:24

My favorite search engine (ecosia) could not find the canonical docs from upstream (SAP) about the meaning of uc_length vs nuc_length.

What is

相关标签:
1条回答
  • 2021-01-28 02:06

    I can't be sure what they do in the Python script, but based on my ABAP/SAP knowledge, I can easily say that:

    • nuc_length: length of the parameter in a non-Unicode ABAP-based system, in number of bytes
    • uc_length: length of the parameter in a Unicode ABAP-based system, in number of bytes

    A non-Unicode ABAP-based system uses one byte to encode each character, while a Unicode ABAP-based system uses two bytes to encode each character. From ABAP 7.50, all systems are Unicode.

    In Unicode ABAP-based system, strings of characters and text fields can store Unicode characters from U+0000 to U+FFFF. Note that characters U+D800 to U+DFFF are considered like actual characters by the ABAP runtime environment (dixit ABAP documentation: "The ABAP programming language supports a subset covered by UCS-2 and not the full UTF-16 set.")

    Note that structured parameters are made of several fields which can mix characters and non-characters, the "uc_length" will double the number of bytes only of the character fields. There are also some dummy bytes between fields because of "alignment".

    In your example, a text field of 80 bytes in a Unicode system corresponds to 40 characters.

    0 讨论(0)
提交回复
热议问题