Forum

> > CS2D > Scripts > Strange thing with utf-8
Forums overviewCS2D overview Scripts overviewLog in to reply

English Strange thing with utf-8

4 replies
To the start Previous 1 Next To the start

old Strange thing with utf-8

0oa
User Off Offline

Quote
Help please!

I wanted to do for RP team !roll,but faced one problem
- Prefix UTF-8 should be written at the beginning text
- When the prefix is supplied,you cannot add plain text

I wanted to connect the phrase 'Кинул кубик,выпало'
with the player's name, and number.
But it turned Cyrillic

- 0oa UTF-8:Xd23/54353/gdgsgd/dgdsrga and bla bla bla


1
2
3
4
5
6
7
8
function rand(id)
  local ply = Player.GetPlayerID(id)
  local x,y = ply:GetPos()
  local str = "\xD0\x9A\xD0\xB8\xD0\xBD\xD1\x83\xD0\xBB\x20\xD0\xBA\xD1\x83\xD0\xB1\xD0\xB8\xD0\xBA\x2C\xD0\xB2\xD1\x8B\xD0\xBF\xD0\xB0\xD0\xBB\xD0\xBE\x20\xD1\x87\xD0\xB8\xD1\x81\xD0\xBB\xD0\xBE"
parse('effect "smoke" ' .. x .. " " .. y .. " " .. " 1 1 255 255 255")
msg(" - " .. ply:Name() .. " : UTF-8:" .. str .. "" .. math.random(0,10))

end

old Re: Strange thing with utf-8

0oa
User Off Offline

Quote
I have scribbles.Lord
I want to know how to connect utf-8: and some text without asf4e/fsfr/afrsdf

Something like this
1
msg("UTF-8:\xD0\x9A\xD0\xB and so on)  " .. "Hello")

And anyway, I solved the problem another way,but I would like to know how without problems to add text.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function rand(id)
  local ply = Player.GetPlayerID(id)
  local x,y = ply:GetPos()
  local str = "\xD0\x92\xD1\x8B\xD0\xBF\xD0\xB0\xD0\xBB\xD0\xBE\x20\xD1\x87\xD0\xB8\xD1\x81\xD0\xBB\xD0\xBE\x20\x3A\x20"
parse('effect "smoke" ' .. x .. " " .. y .. " " .. " 1 1 255 255 255")

local tab = {
[0] = "\x30",
[1] = "\x31",
[2] = "\x32",
[3] = "\x33",
[4] = "\x34",
[5] = "\x35",
[6] = "\x36",
[7] = "\x37",
[8] = "\x38",
[9] = "\x39",
[10] = "\x31\x30"
}
msg("©UTF-8:" .. str .. tab[math.random(0,10)])

end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview