Bug 22032 - sed: в локали UTF8 точка в регулярном выражении не матчит не-UTF8 символы
Summary: sed: в локали UTF8 точка в регулярном выражении не матчит не-UTF8 символы
Status: CLOSED NOTABUG
Alias: None
Product: Sisyphus
Classification: Development
Component: sed (show other bugs)
Version: unstable
Hardware: all Linux
: P3 normal
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-22 19:51 MSD by Vladislav Zavjalov
Modified: 2010-12-13 03:09 MSK (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladislav Zavjalov 2009-10-22 19:51:03 MSD
#!/bin/bash

printf "\xF7\xCf\xD4" | LC_ALL=ru_RU.UTF8 sed -e 's/./X/g'

# ожидаемый вывод "ХХХ", а выводит исходную строчку без изменений
# при том, что в в info sed написано "Matches any character"
Comment 1 Vladislav Zavjalov 2010-12-13 03:09:42 MSK
В том же info sed наткнулся:

`z'
     This command empties the content of pattern space.  It is usually
     the same as `s/.*//', but is more efficient and works in the
     presence of invalid multibyte sequences in the input stream.
     POSIX mandates that such sequences are _not_ matched by `.', so
     that there is no portable way to clear `sed''s buffers in the
     middle of the script in most multibyte locales (including UTF-8
     locales).

Так что это известно и считается правильным. Закрываю как NOTABUG, сочувствую обитателям локали utf8 :)