如何查询和接收这种表格?

时间:2018-04-17 09:29:52

标签: sql-server ascii rtf

ASCII-RTF字符表 表4-1显示了您可以在RTF中访问的主要可打印字符,由ANSI字符集(也称为代码页1252,基本上是Latin-1,其中一些字符添加在128和159之间)定义。第1章的字符格式部分介绍了访问Unicode字符。

请注意,虽然RTF转义符(\'xx)对所有字符都有效,但唯一必须转义的字符是这三个字符:{,}和\,以及代码127上的所有字符。

https://www.safaribooksonline.com/library/view/rtf-pocket-guide/9781449302047/ch04.html

我尝试过这样的事情

You can materialize a table with the ASCII codes or create one dynamically in a query. But be aware that only the code points 0-127 are ASCII characters. Characters in the range 128-255 are determined by the character code page (collation in SQL Server):

WITH 
    t4 AS (SELECT n FROM (VALUES(0),(0),(0),(0)) t(n))
    ,t256 AS (SELECT ROW_NUMBER() OVER (ORDER BY (SELECT 0)) - 1 AS id FROM t4 AS a CROSS JOIN t4 AS b CROSS JOIN t4 AS c CROSS JOIN t4 AS d)
SELECT 
    id
    , CHAR(id) COLLATE SQL_Latin1_General_CP1_CI_AS AS CP1252_Char
    , CHAR(id) COLLATE SQL_Latin1_General_CP437_CI_AS AS CP437_Char
FROM t256;

但与上面的url提供的RTF-ASCII表相比,它有一个空记录。

1 个答案:

答案 0 :(得分:1)

我必须将此作为答案添加,因为下表不适合评论。

对于那些行,我明白了:

+-----+-------------+------------+
| id  | CP1252_Char | CP437_Char |
+-----+-------------+------------+
| 184 | ¸           | ,          |
| 185 | ¹           | 1          |
| 186 | º           | º          |
| 187 | »           | »          |
| 188 | ¼           | ¼          |
| 189 | ½           | ½          |
| 190 | ¾           | _          |
| 191 | ¿           | ¿          |
| 192 | À           | A          |
| 193 | Á           | A          |
| 194 | Â           | A          |
| 195 | Ã           | A          |
| 196 | Ä           | Ä          |
| 197 | Å           | Å          |
| 198 | Æ           | Æ          |
| 199 | Ç           | Ç          |
| 200 | È           | E          |
| 201 | É           | É          |
| 202 | Ê           | E          |
| 203 | Ë           | E          |
| 204 | Ì           | I          |
| 205 | Í           | I          |
| 206 | Î           | I          |
| 207 | Ï           | I          |
| 208 | Ð           | D          |
| 209 | Ñ           | Ñ          |
| 210 | Ò           | O          |
| 211 | Ó           | O          |
| 212 | Ô           | O          |
| 213 | Õ           | O          |
| 214 | Ö           | Ö          |
| 215 | ×           | x          |
| 216 | Ø           | O          |
| 217 | Ù           | U          |
| 218 | Ú           | U          |
| 219 | Û           | U          |
| 220 | Ü           | Ü          |
| 221 | Ý           | Y          |
| 222 | Þ           | _          |
| 223 | ß           | ß          |
| 224 | à           | à          |
| 225 | á           | á          |
| 226 | â           | â          |
| 227 | ã           | a          |
| 228 | ä           | ä          |
| 229 | å           | å          |
| 230 | æ           | æ          |
| 231 | ç           | ç          |
| 232 | è           | è          |
| 233 | é           | é          |
| 234 | ê           | ê          |
| 235 | ë           | ë          |
| 236 | ì           | ì          |
| 237 | í           | í          |
| 238 | î           | î          |
| 239 | ï           | ï          |
| 240 | ð           | d          |
| 241 | ñ           | ñ          |
| 242 | ò           | ò          |
| 243 | ó           | ó          |
| 244 | ô           | ô          |
| 245 | õ           | o          |
| 246 | ö           | ö          |
| 247 | ÷           | ÷          |
| 248 | ø           | o          |
| 249 | ù           | ù          |
| 250 | ú           | ú          |
| 251 | û           | û          |
| 252 | ü           | ü          |
| 253 | ý           | y          |
| 254 | þ           | _          |
| 255 | ÿ           | ÿ          |
+-----+-------------+------------+