编码/代码页:无法从这里到达 [英] Encoding/Codepage: Can't Get There From Here

查看:65
本文介绍了编码/代码页:无法从这里到达的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

长篇故事。我需要将Web用户输入到后端系统中

a)只有单字节编码,b)预测数据转换器

为1字节= 1个字符, c)使用HP Roman-6代码页系统

宽。尽管听起来不错,UTF / Unicode编码也不是一个选项,

也不会改变代码页。


通过编码很容易解决第一个问题。 Default.GetBytes并通过网络将其推上
。但是,Encoding.Default是原生的1280 ANSI

代码页。


我需要做的是将数据从1280 / ISO Latin转换为HP Roman- 6.

到目前为止,我还没有找到任何让我相信这可能是.NET中的b $ b或者没有

编写一个自定义编码类来进行转换。


HP Roman-6代码页可以在网上找到,所以它应该是一个

我想到的两个代码页的映射问题。


鉴于这种情况,解决这个问题的最佳方法是什么?


- = Chris

Long story longer. I need to get web user input into a backend system
that a) only grocks single byte encoding, b) expectes the data transer
to be 1 bytes = 1 character, and c) uses the HP Roman-6 codepage system
wide. As much as it sounds good, UTF/Unicode encoding is not an option,
nor is changing the codepage.

Tackling the first is easy via Encoding.Default.GetBytes and shoving it
over the network. However, Encoding.Default is the native 1280 ANSI
codepage.

What I need to do is convert the data from 1280/ISO Latin to HP Roman-6.
Thus far, I haven''t found anything that leads me to believe this is
possible in .NET or that that specific codepage is supported without
coding a custom Encoding class to do the conversion.

The HP Roman-6 codepage is available on the net, so it should be a
matter of mapping the two codepages I would think.

Given the situation, what''s the best way to tackle this problem?

-=Chris

推荐答案

Christopher H. Laco< me ******** @ gmail.com>写道:
Christopher H. Laco <me********@gmail.com> wrote:
长篇故事。我需要将Web用户输入到后端系统中
a)只有单字节编码,b)预测数据转换器为1个字节= 1个字符,c)使用HP Roman- 6代码页系统广泛。尽管听起来不错,UTF / Unicode编码也不是一个选项,也不是改变代码页。

通过Encoding.Default.GetBytes轻松解决第一个问题并将其推迟。通过网络。但是,Encoding.Default是原生的1280 ANSI
代码页。

我需要做的是将数据从1280 / ISO Latin转换为HP Roman-6。


我建议更好的方法是将数据保存为Unicode

,直到你需要它在HP Roman-6中,并且只解码然后呢。经过

Encoding.Default只会混淆东西,IMO。

到目前为止,我还没有找到任何让我相信这是
可能在.NET中或支持该特定代码页而无需编写自定义编码类来进行转换。

HP Roman-6代码页可在网上获得,因此应该关于映射我认为的两个代码页的问题。

鉴于这种情况,解决这个问题的最佳方法是什么?
Long story longer. I need to get web user input into a backend system
that a) only grocks single byte encoding, b) expectes the data transer
to be 1 bytes = 1 character, and c) uses the HP Roman-6 codepage system
wide. As much as it sounds good, UTF/Unicode encoding is not an option,
nor is changing the codepage.

Tackling the first is easy via Encoding.Default.GetBytes and shoving it
over the network. However, Encoding.Default is the native 1280 ANSI
codepage.

What I need to do is convert the data from 1280/ISO Latin to HP Roman-6.
I''d suggest that a better way would be to keep the data in Unicode
until you need it in HP Roman-6, and only decode it then. Going via
Encoding.Default is only going to confuse things, IMO.
Thus far, I haven''t found anything that leads me to believe this is
possible in .NET or that that specific codepage is supported without
coding a custom Encoding class to do the conversion.

The HP Roman-6 codepage is available on the net, so it should be a
matter of mapping the two codepages I would think.

Given the situation, what''s the best way to tackle this problem?




编写编码并不难,特别是对于固定大小的

字符集。您可能可以使用我已经获得的许多代码来获得
EBCDIC。请参阅
http://www.pobox.com/~skeet / csharp / miscutil


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet

如果回复小组,请不要给我发邮件



Writing an Encoding isn''t that hard, especially for fixed-size
character sets. You might be able to use a lot of the code I''ve got for
EBCDIC. See
http://www.pobox.com/~skeet/csharp/miscutil

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Jon Skeet [C#MVP]写道:
Jon Skeet [C# MVP] wrote:
我需要做的是将数据从1280 / ISO Latin转换为HP Roman-6。

我建议更好的方法是将数据保存为Unicode
直到你需要它在HP Roman-6中,然后才解码它。经历
Encoding.Default只会让事情变得混乱,IMO。
What I need to do is convert the data from 1280/ISO Latin to HP Roman-6.

I''d suggest that a better way would be to keep the data in Unicode
until you need it in HP Roman-6, and only decode it then. Going via
Encoding.Default is only going to confuse things, IMO.




这就是发生的事情。这并不是真正存储在任何会话中的明智之处。我只是想把它转换成后端可以处理的东西

写入我写入套接字之前。


Encoding.Default是我的第一个尝试。我需要做更多的挖掘。我是

我不知道什么是CodePage .NET,当我得到它时,它是什么?

IIS / ASP-> COM->汇编。


编写编码并不难,特别是对于固定大小的
字符集。您可能可以使用我已经获得的许多代码来获取EBCDIC。请参阅
http://www.pobox.com/~skeet / csharp / miscutil




是的,这就是我昨天所看到的。 :-)


- = Chris



Yeah, that''s what I was looking at yesterday. :-)

-=Chris


Christopher H. Laco写道:
Christopher H. Laco wrote:
长篇故事。我需要将Web用户输入到后端系统中
a)只有单字节编码,b)预测数据转换器为1个字节= 1个字符,c)使用HP Roman- 6代码页系统广泛。尽管听起来不错,UTF / Unicode编码也不是一个选项,也不是改变代码页。

通过Encoding.Default.GetBytes轻松解决第一个问题并将其推迟。通过网络。但是,Encoding.Default是原生的1280 ANSI
代码页。

我需要做的是将数据从1280 / ISO Latin转换为HP Roman-6。
到目前为止,我没有找到任何让我相信这可能在.NET中可能的东西,或者支持特定代码页而不用编写自定义编码类来进行转换。
<可以在网上找到HP Roman-6代码页,所以它应该是我想到的两个代码页的映射问题。

鉴于这种情况,有什么'解决这个问题的最佳方法是什么?

- = Chris
Long story longer. I need to get web user input into a backend system
that a) only grocks single byte encoding, b) expectes the data transer
to be 1 bytes = 1 character, and c) uses the HP Roman-6 codepage system
wide. As much as it sounds good, UTF/Unicode encoding is not an option,
nor is changing the codepage.

Tackling the first is easy via Encoding.Default.GetBytes and shoving it
over the network. However, Encoding.Default is the native 1280 ANSI
codepage.

What I need to do is convert the data from 1280/ISO Latin to HP Roman-6.
Thus far, I haven''t found anything that leads me to believe this is
possible in .NET or that that specific codepage is supported without
coding a custom Encoding class to do the conversion.

The HP Roman-6 codepage is available on the net, so it should be a
matter of mapping the two codepages I would think.

Given the situation, what''s the best way to tackle this problem?

-=Chris




说实话,我还是不知道从哪里开始。我仍然有点担心如何从一个代码页转换到另一个代码页实际发生。


从拉丁语转换为HP Roman8很容易因为我有列出源/目录号码的HP Roman 6

代码页。


如何在各种代码页变体中进行转换?

那里有一些数学或过程我无法理解。它的价格可能并不难;这只是我从来没有想过这样的事情

大部分时间。


我可以快速拉丁到hp罗马字节转换在一起,但

表示'不是很稳定。我正在寻找一个适当的无论源代码页如何,都可以将
转换为HP Roman8的解决方案。如果我能在.NET中注册一个自定义代码页并使用

Encoding.GetEncoding(''mycustom''),那将是很好的




- = Chris



To be honest, I still don''t know where to start. I''m still a little
comfused on how converting from one codepage to another actually happens.

Converting from latin to HP Roman8 is easy since I have the HP Roman 6
codepage listing the source/dest numbers.

How does conversion happen among all the various codepage variations?
There''s some math or process there I''m failing to understand. It''s
probably not hard; it''s just that I''ve never had to think of such things
most of the time.

I can just hack a quick latin to hp roman byte conversion together, but
that''s not very stable. I''m looking for a "proper" solution that can
convert to HP Roman8 regardless of the source codepage. It would be nice
if I could just register a custom codepage in .NET and get it using
Encoding.GetEncoding(''mycustom'').

-=Chris


这篇关于编码/代码页:无法从这里到达的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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