Byte sequences in Michelson are written in hexadecimal with a leading 0x. To convert between this representation and reguar UTF8 strings, you can use any tool that is dumb enough to iterate over UTF8 strings byte-per-byte; here is a solution using bash and tezos-codec:
# Encoding an UTF8 string as Michelson bytes
$ MSG='"Привет, мир"'
It is not possible to cast an int to a string in Michelson.
I recommend you to have static error messages, such as:
SOME_ERROR = "SOME_ERROR"
# some contract
x_i = (sp.to_int(params.x + I))
y_j = (sp.to_int(params.y + j))
SmartPy also gives you the option to ...
Strings are serialized as follows:
01 to indicate type string
Four bytes (eight hex chars) to indicate length of string: 0000000c=0x0c=12 in your case
The string represented by its ASCII values: 48656c6c6f20576f726c6421 in your case
The 05 in the beginning is a prefix which is only used by the PACK Michelson instruction which the Bytes.pack function in ...