ascii

Strange results when converting from byte array to string

心已入冬 提交于 2021-02-05 08:44:06
问题 I get strange results when converting byte array to string and then converting the string back to byte array. Try this: byte[] b = new byte[1]; b[0] = 172; string s = Encoding.ASCII.GetString(b); byte[] b2 = Encoding.ASCII.GetBytes(s); MessageBox.Show(b2[0].ToString()); And the result for me is not 172 as I'd expect but... 63. Why does it happen? 回答1: Why does it happen? Because ASCII only contains values up to 127. When faced with binary data which is invalid for the given encoding, Encoding

Replace Polish characteres with standard ascii equivalent

蓝咒 提交于 2021-01-29 17:47:11
问题 Basically, I have a huge amount of files and many of them contain polish letters like 'ł, ż, ź, ó, ń' etc. in their filename. What I want to reach is somehow change this polish letter to standard ascii character. (So for example ż => z, ń => n). The files are located on the server with Linux Debian Squeezee. What should I use and how to achieve the final effect? 回答1: You put a PHP tag to your question, so my answer will consider that. There is a question similiar to yours. Convert national

How do you convert from Hex to Ascii using different inputs in COBOL

时光毁灭记忆、已成空白 提交于 2021-01-29 07:41:48
问题 My intention is to be able to print ascii from HEX-NUM, but I want to be able to change the input Hex values, sort of like this: WORKING-STORAGE SECTION. 01 HEX-INPUT PIC X(2) VALUE "3C". 01 HEX-NUM PIC X VALUE X"HEX-INPUT". However this leads to an error because the X"..." is trying to read HEX-INPUT as Hex values whereas I want to access the value I have defined as 3C. Any ideas what I need to do to achieve this flexibility I desire? I need to change HEX-INPUT often in my program hence the

How do you convert from Hex to Ascii using different inputs in COBOL

情到浓时终转凉″ 提交于 2021-01-29 07:37:39
问题 My intention is to be able to print ascii from HEX-NUM, but I want to be able to change the input Hex values, sort of like this: WORKING-STORAGE SECTION. 01 HEX-INPUT PIC X(2) VALUE "3C". 01 HEX-NUM PIC X VALUE X"HEX-INPUT". However this leads to an error because the X"..." is trying to read HEX-INPUT as Hex values whereas I want to access the value I have defined as 3C. Any ideas what I need to do to achieve this flexibility I desire? I need to change HEX-INPUT often in my program hence the

Difference between breaking and non breaking space ascii characters

六眼飞鱼酱① 提交于 2021-01-28 20:51:48
问题 I have two identical strings in javascript with some spaces. When I printed the ascii values by using str.charCodeAt(n) it is showing the values as 32 and 160. I googled the values and it is showing me as breaking and non breaking spaces. So can anybody explain what is this behaviour. 回答1: The difference between a normal (breaking) space and a non-breaking space is that text display and typesetting software should not insert an automatic line break in place of a non-breaking space. (It is as

How to get ASCII code for characters from a text file?

南楼画角 提交于 2021-01-28 11:50:20
问题 Update, Hello guys Thank you all for the help, my initial approach was wrong and I did not use ASCII codes at all. Sorry for the late replay I had a half-day off today and made a new post for the complete code there is no errors but the prgram is not working proberly ( this is an update of old post ) I wrote the program, and it is working with no errors But it is not giving me the results I wanted My only problem is when I read a character how to check its ASCII and store it. #include <stdio

nHibernate Euro symbol € change for character ¿

蹲街弑〆低调 提交于 2021-01-28 08:22:37
问题 I've tried save a Euro Symbol € using NHibernate and FluentNHibernate in a database Oracle 11g. I have checked a log from NHibernate and see the generated sql statement: UPDATE CURRENCY SET DESCRIPTION = 'Euro', SYMBOL = '€', WHERE ID = 63 When the query from table CURRENCY execute, the column SYMBOL returns ¿ I've tried change the FluentNHibernate Mapping for the column SYMBOL using AnsiString , like this: Map((x) => x.Symbol).Column("SYMBOL").CustomType("AnsiString").Not.Nullable(); But it

How do I send an e-mail with some non-ASCII characters in Python?

孤街醉人 提交于 2021-01-28 07:50:31
问题 I am using Python 3.7 and trying to send e-mails with smtplib. My script works flawlessly so long as the message doesn't contain any Turkish characters such as "ş,ı,İ,ç,ö". The only solution I have found so far that works is using the "string=string.encode('ascii', 'ignore').decode('ascii')" line but when I do that, the string " İşlem tamamlanmıştır." becomes "lem tamamlanmtr." . So how can I keep the original string and bypass this error? The relevant part of the code: import smtplib server

awk convert ASCII to integer in context of awk command

妖精的绣舞 提交于 2021-01-28 06:08:56
问题 I want to do some manipulation on a file with values coded by ASCII symbols. I have a test file that looks something like this: a> b! I would like to use an awk script to to convert them to integer values and then do further manipulation. I've looked and found a method of converting ASCII to integer: for(n=0;n<256;n++)chr[n]=sprintf("%c",n) but I don't know how to pass my integer values from this array to another array wherein I want to do my numeric manipulation. Example output would be: 195

Python 3 itertools.islice continue despite UnicodeDecodeError

拜拜、爱过 提交于 2021-01-28 04:01:02
问题 I have a python 3 program that monitors a log file. The log includes, among other things, chat messages written by users. The log is created by a third party application which I cannot change. Today a user wrote "텋��텋��" and it caused the program to crash with the following error: future: <Task finished coro=<updateConsoleLog() done, defined at /usr/local/src/bserver/logmonitor.py:48> exception=UnicodeDecodeError('utf-8',... say "\xed\xa0\xbd\xed\xb1\x8c"\r\n', 7623, 7624, 'invalid