PyRFC中nuc_length和uc_length参数的含义? [英] The meaning of nuc_length and uc_length parameters in PyRFC?

查看:46
本文介绍了PyRFC中nuc_length和uc_length参数的含义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最喜欢的搜索引擎 (

解决方案

我不能确定他们在 Python 脚本中做了什么,但根据我的 ABAP/SAP 知识,我可以很容易地说:

基于非 Unicode ABAP 的系统使用一个字节对每个字符进行编码,而基于 Unicode ABAP 的系统使用两个字节对每个字符进行编码.从 ABAP 7.50 开始,所有系统都是 Unicode.

在基于 Unicode ABAP 的系统中,字符串和文本字段可以存储从 U+0000 到 U+FFFF 的 Unicode 字符.请注意,字符 U+D800 到 U+DFFF 被 ABAP 运行时环境视为实际字符(dixit ABAP 文档:ABAP 编程语言支持 UCS-2 涵盖的子集,而不是完整的 UTF-16 集.")

请注意,结构化参数由几个可以混合字符和非字符的字段组成,uc_length"将仅将字符字段的字节数加倍.由于 对齐".

在您的示例中,Unicode 系统中 80 个字节的文本字段对应于 40 个字符.

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 the difference between both?

I get these parameters with a modified version of clientPrintDescription.py

解决方案

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.

这篇关于PyRFC中nuc_length和uc_length参数的含义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆