From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Re: viewing docx files Date: Sun, 29 Jan 2017 23:51:00 +0100 Message-ID: <87k29d4h0r.fsf@fastmail.fm> References: <159e5b8b2e0.2800.9343beaceee5adfd5722805b7ce72987@gmail.com> <87wpddijo4.fsf@flaptop.tomnor.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: blaine.gmane.org 1485730308 7520 195.159.176.226 (29 Jan 2017 22:51:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 29 Jan 2017 22:51:48 +0000 (UTC) User-Agent: mu4e 0.9.19; emacs 25.1.50.3 Cc: Devin Prater , help-gnu-emacs@gnu.org To: Tomas Nordin Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jan 29 23:51:40 2017 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 1cXyJw-0001f7-9n for geh-help-gnu-emacs@m.gmane.org; Sun, 29 Jan 2017 23:51:40 +0100 Original-Received: from localhost ([::1]:57089 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXyK1-0000tP-QW for geh-help-gnu-emacs@m.gmane.org; Sun, 29 Jan 2017 17:51:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXyJX-0000r7-0z for help-gnu-emacs@gnu.org; Sun, 29 Jan 2017 17:51:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXyJT-00014K-Jf for help-gnu-emacs@gnu.org; Sun, 29 Jan 2017 17:51:15 -0500 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:35281) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cXyJT-00011c-B3 for help-gnu-emacs@gnu.org; Sun, 29 Jan 2017 17:51:11 -0500 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id C1B1020C0A; Sun, 29 Jan 2017 17:51:07 -0500 (EST) Original-Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Sun, 29 Jan 2017 17:51:07 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.fm; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=6gVCRPy9xuHN6F4ObPYs88poU9E=; b=aT0d7r xbELVb6pPRh4Hdx34lxfIu9PAfL3TPMwlolyr0nDSS/5ZDTpoPymPyp3vlBMeYJj L8N9/9aX5I0mkpSqNVBMkrt0dD2o8plT98GTrEOjXxHgStjK8c9MMiI+rPfRKa2k IFpjVhELkEm0IeeL0/s2bj9qYTMvOdv9Vjwlk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=6gVCRPy9xuHN6F 4ObPYs88poU9E=; b=mWXGe8P6mLSEOz8299uZtUBzTVJCaJwa0Mycz9Zc/x3+PR uZyEF4kfYkOqyaVy9vUtbPUrqylw7f0Fq8Vbrk/MDd3K4Pg0Yf62TVtaemOZnfaV Gb9e94A/Dj3S9KdFaE6zwzja3EcSKOCubYWZUkGWsKdHAvCfs83BIJOz65EFU= X-ME-Sender: X-Sasl-enc: RQjI4P3GNb86cOgzmfPzqZvZ0U7S3y+Bh9Yf0IjdHCbQ 1485730267 Original-Received: from IdeaPad.messagingengine.com (x4d0aabe7.dyn.telefonica.de [77.10.171.231]) by mail.messagingengine.com (Postfix) with ESMTPA id ED8247E399; Sun, 29 Jan 2017 17:51:06 -0500 (EST) In-reply-to: <87wpddijo4.fsf@flaptop.tomnor.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.25 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:112199 Archived-At: On Sun, Jan 29 2017, Tomas Nordin wrote: > Devin Prater writes: > >> Hi all. I'm running Gnu-Emacs (latest brew install emacs >> version) on MacOS >> Sierra. I run Emacs in the terminal, and use the Emacspeak >> package for >> access, since I am blind. I received an email (gnews), with an >> attachment, >> two docx files for reading. I was able to download the >> attachments to my ~/ >> directory. I opened the file (c-x c-f then tab completion), but >> it opened > > I wonder if you would like to eval and try this: > > (defun docx2html (file) > "Convert FILE to html in a buffer and display it." > (interactive "f") > (let ((html-buffer (format "*%s --> html*" file))) > (call-process "pandoc" file html-buffer nil "--to=html") > (switch-to-buffer html-buffer)) > ) > > After evaluation, say M-x docx2html and locate the docx file. > See if it > works. It did not work for me but it seems to have to do with > the > encoding of the characters in the test files I have. I mean, it > works > such that I get the following message from pandoc in the new > buffer: > > pandoc: Cannot decode byte '\xb1': > Data.Text.Encoding.Fusion.streamUtf8: Invalid UTF-8 stream Pandoc only reads and writes UTF-8 and does no conversion. So if the files you want to convert & view are in another encoding, you'll need to reencode them first. Not sure if there's a tool to do that for docx files, though. iconv can convert text files from one encoding to another, but for that to work on docx files, you'll need to unzip them first (and zip them up again afterwards). -- Joost Kremers Life has its moments