Matching degree-based geographical coordinates with a regular expression

后端 未结 4 1258
长情又很酷
长情又很酷 2021-01-21 00:00

I\'d like to be able to identify patterns of the form

28°44\'30\"N., 33°12\'36\"E.

Here\'s what I have so far:

use utf8;
qr{
           


        
4条回答
  •  离开以前
    2021-01-21 00:51

    Try dropping the use utf8 statement.

    The degree symbol corresponds to character value 0xB0 in my current encoding (whatever that is, but it ain't UTF8). 0xB0 is a "continuation byte" in UTF8; it is expected to by the second, third, or fourth character of a sequence that begins with something between 0xC2 and 0xF4. Using that string with utf8 will give you an error.

提交回复
热议问题