如何定义包含非ASCII字符的字符串文字?

编程入门 行业动态 更新时间:2024-10-15 04:24:35
本文介绍了如何定义包含非ASCII字符的字符串文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用Visual Studio 2008在VB.NET中编程。我需要定义一个字符串文字,其中包含等同于Chr(247)的字符÷。 我理解内部VS使用UTF-16编码,但是当源文件写入磁盘时,它包含该字符的单字节值F7。

I'm programming in VB.NET using Visual Studio 2008. I need to define a string literal containing the character "÷" equivalent to Chr(247). I understand that internally VS uses UTF-16 encoding, but when the source file is written to disk it contains the single byte value F7 for this character.

此源文件由默认使用UTF-8编码的另一个程序处理,因此无法正确解释此字符,尝试将其与以下单字节字符组合。 什么编码会将单个字节F7正确解释为单个字符÷?

This source file is processed by another program that uses UTF-8 encoding by default, so it fails to interpret this character correctly, attempting to combine it with the following single-byte character. What encoding would correctly interpret the single byte F7 as the single character ÷?

或者,是否有一种表达非ASCII字面值的方法, ASCII字符 - 像使用某种转义序列?

Alternatively, is there a way of expressing a non-ASCII literal that uses only ASCII characters - like using some kind of escape sequence?

推荐答案

很好,我一直认为默认VS使用UTF-保存文件。但是÷在编码ISO 8859-1中是F7。如果这还不够,您可以在这里:如何更改csharp项目(visual studio / msbuild机器)中的源文件编码?

well, i always thought that by default VS uses UTF-8 to save files. But ÷ is F7 in encoding ISO 8859-1. If this is not enough for you go here: how to change source file encoding in csharp project (visual studio / msbuild machine)?

更多推荐

如何定义包含非ASCII字符的字符串文字?

本文发布于:2023-10-27 10:29:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1533104.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   字符   定义   文字   ASCII

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!