如何在表中插入符号(Alt + Code)并按原样检索它们。 [英] How to insert symbols (Alt+Code) in a table and retreive them as is.
问题描述
我有几个用alt +代码生成的符号,我想在表格中插入和检索它们。这些特殊代码是: -
符号--------------> ALT +数字
======================================= ===
☺---------------------------> Alt + 1
$ b $b☻---------------------------> Alt + 2
♥---------------------------> Alt + 3
♦---------------------------> Alt + 4
$ b $b♣---------------------------> Alt + 5
$ b $b♠---------------------------> Alt + 6
我尝试使用char,nchar,varchar,nvarchar,text和xml但没有任何效果。
请帮助。
I have few symbols which generate with alt+codes , I want to insert & retrieve them in a table. These special codes are:-
Symbol --------------> ALT + Number
==========================================
☺ ---------------------------> Alt + 1
☻ ---------------------------> Alt + 2
♥ ---------------------------> Alt + 3
♦ ---------------------------> Alt + 4
♣ ---------------------------> Alt + 5
♠ ---------------------------> Alt + 6
I tried with char, nchar, varchar, nvarchar, text and xml but nothing worked.
Kindly help.
推荐答案
几乎可以肯定,您正在正确地保存数据库中的值 - 但是不保存的是任何上下文:在这种情况下,您显示的字体是。如果您仔细查看保存的数据,那么完全合理:01,02,03,04,05,06如果您调查原始十六进制值。当你显示它们时,你需要指定正确的字体是全部。
就个人而言,我不会这样做:你依赖于拥有正确字体的用户加载,这是无法保证的 - 用户可以按照自己的意愿添加和删除字体 - 所以我会使用图标或小图片。
我只是猜测你正在尝试创建某种纸牌游戏 - 严肃地说,使用图片代替存储在数据库中的基于字体的字符!
Almost certainly, you are saving the values in the database correctly - but what that doesn't save is any context: in this case the Font that you are displaying them from. If you have a good look at the data saved, it's perfectly reasonable: 01, 02, 03, 04, 05, 06 if you investigate the "raw hex" values. When you display them, you need to specify the right font is all.
Personally, I wouldn't do this: you are dependant on the user having the right font loaded, and that can't be guaranteed - users can add and remove fonts as they wish - so I'd use Icons or small images instead.
I'm just guessing that you are trying to create a card game of some kind - seriously, use pictures instead of font based characters stored in a database!
这篇关于如何在表中插入符号(Alt + Code)并按原样检索它们。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!