T
T
tosha4encko2018-03-21 14:24:33
Python
tosha4encko, 2018-03-21 14:24:33

How to decode cyrillic that ctypes returns?

Here is the code:

mutable_string = create_string_buffer(str.encode(html))
tc.restype = c_char_p
tc.argtypes = [c_char_p]
print('    :     ', tc(mutable_string).decode('utf-8'))

c:
smatch parse_res;
    regex re("(data-opp2)=\"(.+?)\"");
    regex_search(string(html), parse_res, re);
    printf("%s", string(parse_res[2]).c_str());
    return string(parse_res[2]).c_str();

The output inside c++ works fine, but python outputs an empty string
If you replace the regular expression with "(data-opp2)=\"(......)\"" then everything works again (i.e. output in python breaks starting from some character)
python3.5
PyCharm
In python I get html code using grab, I need to parse it using boost / regex.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question