MS“V卡”法国特色菜

发布于 2024-10-29 04:44:44 字数 876 浏览 1 评论 0原文

我正在尝试为网站即时创建 VCard。我只需打开一张使用 Outlook 和 Notepad++ 创建的“真正的”VCard,然后查看我需要的内容即可即时创建一张 VCard。一切工作正常,我可以在需要的地方添加我需要的任何内容。相反,有一点:

  • 所有法国字符,如 É、À、Ê、Ç 等,都显示为:Simon Dugré

我已经添加了 Outlook 创建的建议添加的所有内容:“CHARSET=Windows-1252:” 在我的字符串条目前面(还尝试了 ISO-8859-1、UTF8、UTF7、UTF-8、UTF-7 )并且这些都不起作用。

有什么建议吗?

编辑(在 Alexandre C. 的回答之后)
这是 VCard 源。 请注意,源代码显示正确,但当我用 Outlook 打开它时,仍然遇到重音问题

开始:VCARD 版本:2.1
N;LANGUAGE=fr-ca;CHARSET=UTF-8:杜格雷;西蒙
ORG;CHARSET=utf-8:公司名称éàêâç
电话;工作;语音:5555555555
X-MS-OL-默认邮政地址:0
电子邮件;PREF;INTERNET:[电子邮件受保护]
X-MS-OL-DESIGN;CHARSET=utf-8:[VCard HTML 格式]
版本:20110404T135700
结束:VCARD

I'm trying to create VCard on the fly for a site. I simply open a "real" VCard once create with Outlook with Notepad++ and saw what I need into it to create one on the fly. Everything works fine and I'm able to add anything I need, where I need. Instead one point :

  • All french caracters such as É, À, Ê, Ç, etc showing like : Simon Dugré.

I've add everything suggested by the Outlook created one who's proposing to add : "CHARSET=Windows-1252:" in front of my string entry (also tryied ISO-8859-1, UTF8, UTF7, UTF-8, UTF-7) and none of those are working.

Any suggestion?

EDIT (After Alexandre C.'s answer)
Here is the VCard source. Please note that the source shows it correctly, but when I open it with Outlook, I still have the accent problem :

BEGIN:VCARD
VERSION:2.1
N;LANGUAGE=fr-ca;CHARSET=UTF-8:Dugré;Simon
ORG;CHARSET=utf-8:CompanyNameéàêâç
TEL;WORK;VOICE:5555555555
X-MS-OL-DEFAULT-POSTAL-ADDRESS:0
EMAIL;PREF;INTERNET:[email protected]
X-MS-OL-DESIGN;CHARSET=utf-8:[VCard HTML Format]
REV:20110404T135700
END:VCARD

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

泪眸﹌ 2024-11-05 04:44:44

您应该编写 CHARSET=utf-8 而不是 CHARSET=UTF-8

vCard 规范建议字符集应独立于大小写,但 Outlook 并不关心。

You should write CHARSET=utf-8 and not CHARSET=UTF-8.

vCard specs suggest that character set should be case independent, but Outlook does not care.

不奢求什么 2024-11-05 04:44:44

这是 good 行:

currentPage.Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0} {1}.vcf", this.FirstName, this.LastName));
currentPage.Response.ContentType = "text/x-vcard";
currentPage.Response.ContentEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1"); // THIS LINE
currentPage.Response.Write(content);
currentPage.Response.End();

而不是:

currentPage.Response.Charset = "ISO-8859-1";

Here is the good line:

currentPage.Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0} {1}.vcf", this.FirstName, this.LastName));
currentPage.Response.ContentType = "text/x-vcard";
currentPage.Response.ContentEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1"); // THIS LINE
currentPage.Response.Write(content);
currentPage.Response.End();

Instead of :

currentPage.Response.Charset = "ISO-8859-1";
浮云落日 2024-11-05 04:44:44

尝试使用 utf8utf-8 作为字符集。

Try utf8 or utf-8 as the charset.

温柔戏命师 2024-11-05 04:44:44

这是一个适合我的版本。

<%@ Page Language="C#"  CodePage=1252 %>
<%
Response.Charset ="windows-1252";
Response.ContentType="text/x-vcard";
Response.AddHeader("Content-Disposition", "attachment; filename=test.vcf" );
 %>
BEGIN:VCARD
VERSION:2.1
N:;Dugré;Simon
FN:Simon Dugré
ORG:CompanyNameéàêâç
TEL;WORK;VOICE:5555555555
EMAIL;PREF;INTERNET:[email protected]
REV:20110405T164322Z
END:VCARD

这将正确加载到 Outlook 2003 中。

Here is a version that works for me.

<%@ Page Language="C#"  CodePage=1252 %>
<%
Response.Charset ="windows-1252";
Response.ContentType="text/x-vcard";
Response.AddHeader("Content-Disposition", "attachment; filename=test.vcf" );
 %>
BEGIN:VCARD
VERSION:2.1
N:;Dugré;Simon
FN:Simon Dugré
ORG:CompanyNameéàêâç
TEL;WORK;VOICE:5555555555
EMAIL;PREF;INTERNET:[email protected]
REV:20110405T164322Z
END:VCARD

This loads correctly into Outlook 2003.

半城柳色半声笛 2024-11-05 04:44:44

我还遇到了特殊字符(波兰语)的问题。我不确定 Outlook 中的 utf-8 编码是否有问题或其他问题。使用 utf-8 的多种方法之后:

Response.ContentType = "text/x-vcard; charset=UTF-8";

Response.HeaderEncoding = Encoding.GetEncoding("UTF-8") ;

Response.ContentEncoding = Encoding.GetEncoding("UTF-8");

Response.Charset = "UTF-8";

我决定尝试 Windows- 1250 编码,(在我的例子中)有效!尝试删除不必要的行后,发现我唯一需要的行是:

Response.ContentEncoding = Encoding.GetEncoding("Windows-1250");

我还推荐 vCard 库对我帮助很大。

I also had a problem with special characters (polish language). I am not sure if there's a problem with utf-8 encoding in Outlook or something else. After multiple approaches with utf-8:

Response.ContentType = "text/x-vcard; charset=UTF-8";

Response.HeaderEncoding = Encoding.GetEncoding("UTF-8");

Response.ContentEncoding = Encoding.GetEncoding("UTF-8");

Response.Charset = "UTF-8";

I decided to try Windows-1250 encoding, which (in my case) worked! After trying to remove unnecessary lines it turned out that the only line i need is:

Response.ContentEncoding = Encoding.GetEncoding("Windows-1250");

I also recommend vCard library which helped me a lot.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文