From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Is there a way to "asciify" a string? Date: Sun, 27 May 2018 19:07:40 +0300 Message-ID: <83d0xh84kz.fsf@gnu.org> References: <87zi0llisj.fsf@mbork.pl> <20180527073645.GB17354@tuxteam.de> <87y3g5l1h0.fsf@mbork.pl> <871sdxgt05.fsf@iki.fi> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1527437178 7546 195.159.176.226 (27 May 2018 16:06:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 27 May 2018 16:06:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 27 18:06:14 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fMyBQ-0001s9-Va for geh-help-gnu-emacs@m.gmane.org; Sun, 27 May 2018 18:06:13 +0200 Original-Received: from localhost ([::1]:52565 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMyDY-0004QI-4K for geh-help-gnu-emacs@m.gmane.org; Sun, 27 May 2018 12:08:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMyD4-0004Pv-3b for help-gnu-emacs@gnu.org; Sun, 27 May 2018 12:07:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fMyD0-0006Qo-VR for help-gnu-emacs@gnu.org; Sun, 27 May 2018 12:07:54 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51172) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMyD0-0006Qg-S7 for help-gnu-emacs@gnu.org; Sun, 27 May 2018 12:07:50 -0400 Original-Received: from [176.228.60.248] (port=2427 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fMyD0-0003Zv-B4 for help-gnu-emacs@gnu.org; Sun, 27 May 2018 12:07:50 -0400 In-reply-to: <871sdxgt05.fsf@iki.fi> (message from Teemu Likonen on Sun, 27 May 2018 15:52:58 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116872 Archived-At: > From: Teemu Likonen > Date: Sun, 27 May 2018 15:52:58 +0300 > Cc: help-gnu-emacs > > > (BTW, if there is some command-line utility to do that, that's fine > > too.) > > There is iconv: > > $ echo багд | iconv -t ASCII//TRANSLIT > aaaa > > So an Emacs Lisp wrapper function for iconv can be written like this: > > (defun my-iconv-ascii-translit (string) > (with-temp-buffer > (insert string) > (call-process-region (point-min) (point-max) > "iconv" t t nil "-t" "ASCII//TRANSLIT") > (buffer-substring-no-properties (point-min) (point-max)))) Come on, crowd, you _must_ know that Emacs has all of the iconv's functionality (and more) built-in, right? All that encode-coding stuff etc.? Btw, ASCII//TRANSLIT doesn't necessarily guarantee it will succeed in removing all the diacritics, AFAIK. You need to completely decompose the characters for that, and AFAIK iconv doesn't have such capabilities. (Emacs does.)