MS“V卡”法国特色菜
我正在尝试为网站即时创建 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您应该编写
CHARSET=utf-8
而不是CHARSET=UTF-8
。vCard 规范建议字符集应独立于大小写,但 Outlook 并不关心。
You should write
CHARSET=utf-8
and notCHARSET=UTF-8
.vCard specs suggest that character set should be case independent, but Outlook does not care.
这是 good 行:
而不是:
Here is the good line:
Instead of :
尝试使用
utf8
或utf-8
作为字符集。Try
utf8
orutf-8
as the charset.这是一个适合我的版本。
这将正确加载到 Outlook 2003 中。
Here is a version that works for me.
This loads correctly into Outlook 2003.
我还遇到了特殊字符(波兰语)的问题。我不确定 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.