问题标签 [iso-8859-1]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
php -  编码问题
我正在使用 PHP 开发一个网站,这些奇怪的字符“”出现在我的页面上,就在它的顶部。我的代码是这样的:
但是当我在浏览器中看到源代码时,它会显示:
我不知道是否与我正在使用的编码有任何关系,因为当我将字符集更改为charset=utf-8
它时它会消失但我必须使用 iso-8859-1
java - RestEasy csv file upload (multipart / form-data) garbles iso-8859-1 characters in FireFox
I have a multipart / form-data form to upload a csv file to a rest easy (JAX RS) webservice. This file can contain iso-8859-1 characters like for example é. When I upload the file through Firefox these characters are garbled and they end up like a ?. When I upload the file through Internet Explorer everything works fine.
I've done a lot of reading and found out that there's a problem in firefox combining multipart / form-data and the charset attribute (enctype='multipart/form-data; charset=ISO-8859-1'
) doesn't work.
So I've tried setting <meta http-equiv="Content-Type" content="text/csv; charset=iso-8859-1" />
in my HTML page (I also tried setting text/html or multipart/form-data in stead of text/csv but none of that seems to make a difference.
I went through the rest easy api and found something about 'overwriting the default fallback content type for multipart messages'. The default fallback when no content type is found is us-ascii. The characters I try to process (é,..) don't exist in us-ascii so it makes sense they end up garbled. Overriding this default fallback content type doesn't seem to help either (see: http://docs.jboss.org/resteasy/docs/1.2.GA/userguide/html/Multipart.html)
So am I right when I say that Internet Explorer sends the content-type+charset correctly in the http header, so everything goes well. And that firefox messes things up while trying to send the content-type/charset while combined with multipart/form-data? I have done my searching through stackoverflow but none of the approved solutions seem to work in my case.
Has anybody had this specific problem before? (multipart / form-data file upload using Jboss rest easy framework)? Something else I can try?
Thanks in advance!
Yannick
iphone - 在 iPhone/iPad SDK 中使用 Latin-1 (ISO 8859-1) 编码的 HTML 解码
我为丹麦的一个网站创建了一个 rss 阅读器,他们的 CDATA 中有这样的内容:
请帮我将丹麦语文本 - 由 mod oversvømmelse 在 sikre Blåvand 解码 - 以 unicode 格式转换为 NSString。
iphone - 读取使用 iso-8859-1 生成的 plist
我使用 .net 环境创建了一个 plist,创建后我在 plist 编码类型中将编码类型设置为“iso-8859-1”。然后我尝试阅读它并在表格视图中显示。值与预期不符。
它的编码类型不正确的字符很少。
我应该怎么办 ?
.net - c# 中的 iso-8859-1 到 utf-8
有没有办法将 iso-8859-1 的 xml 文件转换为 utf-8 ?
php - PHP:将“'”字符从 ISO-8859-1 转换为 UTF-8 时出现问题
我在使用 PHP 将 ISO-8859-1 数据库内容转换为 UTF-8 时遇到了一些问题。我正在运行以下代码进行测试:
当我在 Firefox 的源代码视图中运行它时,确保 Firefox 的编码设置设置为“Western (ISO-8859-1)”,我得到这个:
到目前为止,一切都很好。第一个输出包含那个奇怪的引用,我可以正确地看到它,因为它在 ISO-8859-1 中,Firefox 也是。
在我将 Firefox 的编码设置更改为“UTF-8”后,它看起来像这样:
报价去哪儿了?不iconv()
应该将其转换为 UTF-8 吗?
html - 一个 HTML 页面内可能有多个字符编码?
我有一个设置为UTF-8的网页。但其部分内容(内置 php)来自iso-8859-1文件,因此无法正确显示。
是否可以为特定页面元素设置特定编码?
android - 如何将二进制数据 (ISO-8859-1) 转换为字符串
我创建了一个安卓应用程序。它在端口上发送数据消息,用于与其他手机上的同一应用程序进行通信。在发送消息时,我已使用 ISO8859_1 编码将其编码为二进制数据。
byte[] b1=payload.getbytes();
我能够在接收端接收数据消息。但问题是,在以二进制格式接收后,我的应用程序需要将消息解码回字符串或人类可读格式。但我不能这样做。
我尝试使用'toString()'将其转换为字符串,但字符串包含二进制字符。
请帮忙。
c# - WCF 异常:文本消息编码和 ISO-8859-1 编码
我正在尝试使用 VS 2008、.net 3.5、WCF(环境:Windows XP 和 VS 2008)来使用外部 Web 服务(该 Web 服务具有 PHP 实现)。我将服务引用添加到 Web 服务,VS 生成 WCF 代理。
绑定是basicHttpBinding。
我使用代理调用 Web 服务中的方法,然后我开始收到 ProtocolException,我收到以下错误消息:
System.ServiceModel.ProtocolException:内容类型 text/xml;响应消息的 charset=ISO-8859-1 与绑定的内容类型不匹配 (text/xml; charset=utf-8)。如果使用自定义编码器,请确保正确实现 IsContentTypeSupported 方法。
响应的前 644 个字节是:
这很成功
好吧,我需要调用 iso-8859-1 编码的服务。
任何有用的示例源代码来解决它?
更新:
WCF 中使用的默认编码器仅适用于 UTF-8 和 UTF-16(大端和小端)。
如果我在 app.config 的绑定中使用 textEncoding="iso-8859-1",
我收到此错误:
System.ArgumentException: No se admissione la codificación de texto 'iso-8859-1' usada en el formato de mensaje de texto。Nombre del parametro:编码。
System.ServiceModel.Channels.TextEncoderDefaults.ValidateEncoding(编码编码) System.ServiceModel.Channels.TextMessageEncodingBindingElement.set_WriteEncoding(编码值) System.ServiceModel.BasicHttpBinding.set_TextEncoding(编码值) System.ServiceModel.Configuration.BasicHttpBindingElement.OnApplyConfiguration(绑定绑定) System.ServiceModel.Configuration.StandardBindingElement.ApplyConfiguration(绑定绑定) System.ServiceModel.Description.ConfigLoader.LookupBinding(字符串 bindingSectionName,字符串 configurationName,ContextInformation 上下文) System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint,String configurationName)系统。 ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName) System.ServiceModel.ChannelFactory。InitializeEndpoint(String configurationName, EndpointAddress address) ctor(String endpointConfigurationName, EndpointAddress remoteAddress) CreateSimplexFactory() CreateChannelFactory() CreateChannelFactoryRef(EndpointTrait`1 endpointTrait) InitializeChannelFactoryRef() ctor() IntegracionEasyVista.ServiceEasyVista.WebServicePortTypeClient..ctor() in
更新:
从 WCF 调用使用 ISO-8859-1 编码的 Web 服务
从 WCF 调用使用 ISO-8859-1 编码的 Web 服务
这个 MSDN 页面 ( http://msdn.microsoft.com/en-us/library/ms751486(v=VS.90).aspx ) 展示了如何创建一个“CustomTextEncoder”,它可以支持超过 utf-8、utf- 16 和 unicode 编码。它包含完整的示例源代码,对我来说非常有用。
我使用 CustomTextMessageEncodingElement,但出现错误:
内容类型 text/xml;响应消息的 charset=ISO-8859-1 与绑定的内容类型不匹配 (text/xml;charset=iso-8859-1)。如果使用自定义编码器,请确保正确实现 IsContentTypeSupported 方法。响应的前 1024 个字节是:**
从示例 MSDN 的代码中,我修改了 CustomTextMessageEncoder 类的构造函数:
我将“{0};charset={1}”替换为“{0};charset={1}”(我已经包含了一个空白)
然后,我得到错误:
传出消息的消息版本 (Soap11 ( http://schemas.xmlsoap.org/soap/envelope/ ) AddressingNone
( http://schemas.microsoft.com/ws/2005/05/addressing/none )) 不匹配编码器
(Soap12(http://www.w3.org/2003/05/soap-envelope)Addressing10(http://www.w3.org/2005/08/addressing))。
确保绑定配置为与消息相同的版本。
.net - 让 HttpWebRequest 使用 ISO-8859-1 编码进行 urlencoding
我在让 HttpWebRequest 对 webrequest 中的参数使用 ISO-8859-1 编码时遇到问题,该问题与 POST 和 GET 有关。
简而言之,问题是任何包含非 ascii 字符(如 Ö 和 æ)的请求参数都会转换为它们的 UTF-8 % 表示,而不是它们的 ISO-8859-1 表示。
Ö 被转换为 %c3%96 而不是 %d6。
我目前对解决方案的想法是将请求字符串转换为 ISO-8859-1 字节数组,然后将字节数组转换回 UTF-8,char for char,同时捕获任何大于 127 的字节并将其转换为它们的 %十六进制值。
有没有更好的方法来解决这个问题?