简体   繁体   English

使用JAVA进行EDIFACT映射

[英]EDIFACT Mapping using JAVA

I am trying to map EDIFACT files using java. 我正在尝试使用Java映射EDIFACT文件。

The data I'm using is encoded and it looks like this: UNBIATB11AMS135682300687X 我正在使用的数据已编码,如下所示:UNBIATB11AMS135682300687X

I'm expecting this format: UNH+1+SBRRES:09:3:1A' 我期望使用以下格式:UNH + 1 + SBRRES:09:3:1A'

Can anyone please help me figure this out? 谁能帮我解决这个问题?

Thanks in advance. 提前致谢。

Your text seems to contain 0x1D , 0x1F , and 0x1C characters. 您的文本似乎包含0x1D0x1F0x1C字符。

If you replace 0x1D with + , 0x1F with : , and 0x1C with ' , you get: 如果用+替换0x1D ,用:替换0x1F ,用'替换0x1C ,则得到:

UNB+IATB:1+1A+MS+13568:230+0687+++X'

You probably shouldn't replace, but simply parse using those non-displayable characters, but if you need displayable, you can do this: 您可能不应该替换,而只是使用那些不可显示的字符进行解析,但是如果您需要可显示的字符,则可以执行以下操作:

s = s.replace('\u001D', '+').replace('\u001F', ':').replace('\u001C', '\'');

Or replace with whatever characters is not otherwise in the data. 或者用数据中没有的其他字符替换。 That is likely why they use those non-displayable characters, because they are guaranteed to not be in the text data. 这可能是为什么它们使用那些不可显示的字符的原因,因为可以保证它们不会出现在文本数据中。 Remember, the computer doesn't care whether a character is displayable, only humans do. 请记住,计算机并不关心角色是否可以显示,只有人类可以做到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM