chr() is a function in Python or PHP which returns the character (string of length one) that corresponds to an ASCII code point.
Questions tagged [chr]
166 questions
3
votes
1 answer
Why Doesn't VBA replace function work with CRLF in Word and Excel
I could have sworn I have stripped CRLF in the past but not sure why the following isn't working:
myString = "ABC" & vbCrLf & "DEF"
str1 = Replace(myString, vbLf, "")
str2 = Replace(str1, vbCrLf, "")
str3 = Replace(str2, vbNewLine, "")
MsgBox…

Mickey D
- 347
- 2
- 12
3
votes
1 answer
Differences with chr() function between PHP 5.6 and 7
I downloaded the following code from a website for encoding GSM characters in SMS messages sned through their gateway.
Here's my test code:
$body = '£¥$@"\'.,;:_-=+*#%&<>?!¿¡§¤()ÄÖÑÜÉÅßÇÆΦΓΔΛΩΣΠΨΘØΞñüäòøàæåèéöùì{}[]|~^€';
$characters = array(
…

Ben Sinclair
- 3,896
- 7
- 54
- 94
3
votes
2 answers
PHP function chr and ord with special chars
In PHP when I use the ord function in order to catch the ASCII code of my character I get this behavior:
ord("a") // return 97
chr(97) // return a
But when I use a special character like Œ the returns are different:
ord("Œ") // return 197
chr(197)…

Thibault KEROUANTON
- 31
- 2
3
votes
1 answer
Delphi XE3: Chr Ansi Version?
I have my own D6 pas library with crypto functions.
Today I tried to use it under XE3, and I found many bugs in it because of unicode.
I tried to port to AnsiString, but I failed on chr(nnn) which was 8 bit limited under Delphi6.
I'm trying to…

durumdara
- 3,411
- 4
- 43
- 71
2
votes
1 answer
Convert int to ascii [chr()] in django template
I am writing a django application, and in a loop,
{% for item in list %}
{{ forloop.counter0 }}
{% endfor %}
this will printout the number in the loop starting from 0. But I want to printout alphabet starting from 'A', so the python way…

bernardw
- 1,370
- 3
- 15
- 27
2
votes
1 answer
CHR: How do you call Prolog code inside a rule
CHR: How do you call Prolog code inside a rule ?
I assume it is like DCG !!! but doesn't seem right
:- use_module(library(chr)).
:- chr_constraint move/2,pos/2, next/0.
:- [utils].
main :- pos(5,5).
rand(X,Y) :- random(0,2,X), random(0,2,Y),…

sten
- 7,028
- 9
- 41
- 63
2
votes
1 answer
echo char(128) and above from php does not work
I have a server side process.php script that echos two chars:
echo chr(127);
echo chr(128);
On the client side, I have a java script (running in an html page with UTF-8 encoding) that posts to the php script and expects a response:
const xhr = new…

ssg
- 83
- 6
2
votes
1 answer
chr not show ascii extended symbol from CLI request
i have invoke from cli and php script like that:
# php test.php
the php script content:
user10771503
2
votes
1 answer
Perl: Passing Unicode string to chr()
I'm pretty new to Perl so pardon me for what will probably turn into a most obvious answer.
I'm trying to pass a Unicode markup to the chr() function.
Here's a redacted example of my script.
#!/usr/bin/perl
$unicode = "/u0026amp;";
print…

Aurelius
- 23
- 3
2
votes
0 answers
JavaScript "String.fromCharCode" is returning a different set of characters than Python's "chr" function is
I am trying to run an encryption algorithm that takes an input message, breaks it up into blocks of four characters, moves "x" bits from the front to the back, and then converts it back into four scrambled characters. I believe that this is called a…

NightOwl
- 21
- 4
2
votes
1 answer
How to use the chr function inside a regular expression in Perl?
I have a Perl script which has a string which may or may not contain character 146 in the ASCII character codes. I'm interested in using the chr() function inside a regular expression to find out if that string really does contain that character. If…

Steve Johnson
- 949
- 3
- 12
- 13
2
votes
2 answers
Python 3 function to convert "Д" to string
The task is to convert Де to Де.
Does Python 3 has builtin function or I need to parse this string and then use builtin chr method to convert each number to string?

Artem Rys
- 149
- 9
2
votes
1 answer
How to get code point of a character in elisp (and other way too)?
I was very surprised not to be able to find this in the elisp manual or SO. I just want the equivalent of many languages' chr() and ord() or similar: convert between actual characters and their (unicode) code point values.
Emacs Lisp: getting ascii…

TextGeek
- 1,196
- 11
- 23
2
votes
1 answer
Mysqldump breaks output when using CHAR(0), "\0" or 0x0
I have a problem with this little piece of a MySql query:
SELECT
`p`.`person_id`,
`p`.`prename`,
`p`.`name`,
(
SELECT GROUP_CONCAT(`node`.`name` SEPARATOR "\0")
FROM `node`
INNER JOIN `nodegroup`
ON `nodegroup`.`nodegroup_id` =…

Marco
- 960
- 2
- 7
- 26
2
votes
2 answers
Python chr() function outputting incorrectly
I am having problems with the chr() function. My code first takes the user input, puts it into an array and then uses the ord function to convert it to the corresponding number value and does the same with a keyword. It then uses the zip function to…

CoolestKidAround
- 21
- 1
- 4