将 EBCDIC 字符插入 javascript 字符串
我需要在 JavaScript 中创建一个 EBCDIC 字符串并将其保存到 EBCDIC 数据库中。然后 EBCDIC 系统上的进程会使用该数据。直到我遇到了“Ø”这个字符,我才遇到了任何问题。在 EBCDIC 中,它是 5F 的十六进制值。所有常见的字母和符号似乎都会毫无问题地自动转换。知道如何在 javascript 中创建 'Ø' 的 EBCDIC 值,以便我可以将其正确存储在 EBCDIC 数据库中吗?
谢谢!
I need to create an EBCDIC string within my javascript and save it into an EBCDIC database. A process on the EBCDIC system then uses the data. I haven't had any problems until I came across the character '¬'. In EBCDIC it is hex value of 5F. All of the usual letters and symbols seem to automagically convert with no problem. Any idea how I can create the EBCDIC value for '¬' within javascript so I can store it properly in the EBCDIC db?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果“所有常见的字母和符号似乎都会自动转换”,那么我强烈怀疑您不必在 Javascript 中创建 EBCDIC 字符串。 EBCDIC 中的拉丁字母和数字的字符代码与 Unicode 中的完全不同,因此服务器代码中的某些内容已经在转换字符串。
因此,您需要确定该过程如何工作,特别是您需要了解翻译如何将字符代码从 Unicode 源映射到 EBCDIC 等效项。了解这一点后,您就会知道在 Javascript 代码中使用什么 Unicode 字符。
进一步说明:每次 IT 组织告诉我他们的大型机软件要求以 EBCDIC 提供数据时,这个建议都是完全错误的。事实上,有一些外部接口意味着构成大型机及其触角的铁堆中的某些东西已经映射了“现实世界”的特征,而IT人员已经忘记了这些东西,并且如果需要的话可能无法找到它们Unicode 等编码转换为 EBCDIC。它是如何运作的?好吧,这可能是无法弄清楚的。
您可以尝试一下这是否有效:
var notSign = "\u00AC";
编辑: 另外:这里有一个关于 HTML 实体和 Unicode 字形的很好的参考:http://www.elizabethcastro.com/html/extras/entities.html HTML/XML 语法使用十进制数字作为字符代码。对于 Javascript,您必须将它们转换为十六进制,Javascript 字符串中的表示法是“\u”,后跟 4 位十六进制常量。 (该参考资料并不完整,但它很容易阅读,并且有很多有用的符号。)
If "all of the usual letters and symbols seem to automagically convert", then I very strongly suspect that you do not have to create an EBCDIC string in Javascript. The character codes for Latin letters and digits are completely different in EBCDIC than they are in Unicode, so something in your server code is already converting the strings.
Thus what you need to determine is how that process works, and specifically you need to find out how the translation maps character codes from Unicode source into the EBCDIC equivalents. Once you know that, you'll know what Unicode character to use in your Javascript code.
As a further note: every single time I've been told by an IT organization that their mainframe software requires that data be supplied in EBCDIC, that advice has been dead wrong. The fact that there's some external interface means that something in the pile of iron that makes up the mainframe and it's tentacles, something the IT people have forgotten about and probably couldn't find if they needed to, is already mapping "real world" character encodings like Unicode into EBCDIC. How does it work? Well, it may be impossible to figure out.
You might try whether this works:
var notSign = "\u00AC";
edit: also: here's a good reference for HTML entities and Unicode glyphs: http://www.elizabethcastro.com/html/extras/entities.html The HTML/XML syntax uses decimal numbers for the character codes. For Javascript, you have to convert those to hex, and the notation in Javascript strings is "\u" followed by a 4-digit hex constant. (That reference isn't complete, but it's pretty easy to read and it's got lots of useful symbols.)