X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=CcANpydSm4nRz9YKKL44FZyr4EfEtFbhHlz23VDcZJK/8rYgVgTlV K+NXPZuPsbnaP/d012lCLZgPfAk2oSVY2pyv+xQWtQhqqDafFcy0yx2V6SRykcDB sJPudfYTaffBzzzhjA18LeDvchgftTr9ui9tG9ujoxnqUki1nHYaKc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=d6gAMFYZ5EEro2uBngjNxofQl5o=; b=i0+TT1pTEnlQ+VUM2/+siqZq28k4 ZPhFVdC1lcb+WZEateb6UY7j8G+yaFLmOBs8B3c9n6YcG7V7AJ3CDcBYmnk2wgrs Oe8G4J/FiyiEKnlC/KLvH8Q/OaJpN5A3qd8fm/Ay2KJ4ruK2ZfPLraDwm1+pRBky sXMq39x9sa0g8Q0= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-101.2 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy= X-HELO: mout.kundenserver.de Date: Mon, 3 Sep 2018 19:16:59 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Cygwin fails to utilize Unicode replacement character Message-ID: <20180903171659.GY6350@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <7942b18e-96bf-a824-4dac-82715d87af55 AT towo DOT net> <5b8bdcc4 DOT 1c69fb81 DOT 84d1a DOT e6b9 AT mx DOT google DOT com> <20180903124616 DOT GT6350 AT calimero DOT vinschen DOT de> <20180903145919 DOT GU6350 AT calimero DOT vinschen DOT de> <126ebbde-2432-f19b-6c5c-fe61f31e4647 AT towo DOT net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="JVVqWhpkAs5raV7A" Content-Disposition: inline In-Reply-To: <126ebbde-2432-f19b-6c5c-fe61f31e4647@towo.net> User-Agent: Mutt/1.9.2 (2017-12-15) --JVVqWhpkAs5raV7A Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sep 3 18:34, Thomas Wolff wrote: > Am 03.09.2018 um 16:59 schrieb Corinna Vinschen: > > On Sep 3 14:46, Corinna Vinschen wrote: > > > On Sep 2 05:51, Steven Penny wrote: > > > > On Sun, 2 Sep 2018 10:07:10, Thomas Wolff wrote: > > > > > Actually, the width problem I suggested in my other response (and= even > > > > > referring to the wrong character) does not apply as mintty enforc= es > > > > > proper width in that case. > > > > > Also, even with fonts that do not provide the glyph, you will usu= ally > > > > > still see it by the Windows font fallback mechanism. > > > > > Shall I make it configurable? > > > > your call - here are the possible resolutions - in order of my pref= erence: > > > >=20 > > > > 1. Change the default to U+FFFD with no option > > > > 2. Change the default to U+FFFD with option to change > > > > 3. Leave default as is with option to change > > > Ideally we could check if the current font supports a visual > > > representation of 0xfffd and if not, fall back to 0x2592. > > >=20 > > > Not sure how feasible that is, but it doesn't seem to be overly > > > complicated. I'm just looking into a solution for the Cygwin > > > console. > > Only, I can't get this working. In theory the GDI function > > GetGlyphIndicesW is supposed to allow checking if a certain character > > exists. But I'm getting a weird result. This code: > >=20 > > static const wchar_t replacement_char[2] =3D > > { > > 0xfffd, /* REPLACEMENT CHARACTER */ > > 0x2592 /* MEDIUM SHADE */ > > }; > > HWND cwnd =3D GetConsoleWindow (); > > HDC cdc =3D GetDC (cwnd); > > int rp_idx =3D 0; > > WORD gi =3D 0; > > DWORD ret =3D GetGlyphIndicesW (cdc, replacement_char, 1, &gi, > > GGI_MARK_NONEXISTING_GLYPHS); > > if (ret !=3D GDI_ERROR && gi =3D=3D 0xffff) > > rp_idx =3D 1; > >=20 > > always sets rp_idx to 1 when called from inside the Cygwin DLL, > > independently of the actual console font. And, here's the really weird > > thing, it always sets rp_idx to 0 when called directly from an > > application, likewise independently of the actual console font. > >=20 > > Does anybody have an idea what I'm doing wrong? > This works in mintty, just uploaded a patch. Maybe somehow the GetConsole > "dc" does not support this usage? =C2=AF\_(=E3=83=84)_/=C2=AF But I'm glad it works for you. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --JVVqWhpkAs5raV7A Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAluNbIsACgkQ9TYGna5E T6ArDQ//YmZFDEaLgVkJiSJs8jq6FpfJ6Vzp+LbtTbtuDQcnhKb4u2PokXWsS1UU socJP+lvu+XC2ZfnNiSpJuagQwpxUmup4/a7K3QWg60jDaf4+mLg1zw6Vmm2c1vy xxpzmntDsqeKVHo0F2J583aAfeUHMd//ZW2dZI+HdjooAPrVhXhRoEcPBDOy79jU gUQJSkxtY+ulC/X0jEzJAYxQqsHISIF3QIjCvIXMLn3tlBMnJs8JL0XgyyxgHwF1 hF81aTNsEvSkofi2RjdMyTXCLfo32KSqTlo4E5IbrCRWw5Bsd3sbOlGiMsjJGi8g osAM4Z6OGmcZucSNHJ813TxIde1SwOc46HCdHURgCvwdpAwLIisNPK0j6rDlpeva kBh2FlQt0LYTRCRwjNy6hLr9cYP7rBc/xmabWIyrBsiUGZYFWXTGc+DShuhrMQ74 gIPOSWreh+87xd6y2QU1cISzfxYZw1Z8G90iGqo4y/lZsUETeBBkm+UqKe2FVX+m h0ZQEUhuEtR0Z78GurL4/9QlLtrE+4MdgNWKp/E+Dq2bGMJcX96/YbuoOLv7WilF 86dAFav0besbcuhmfXUPQBQfj8qGbambptRHTGO5CfFuQAEc2zBU3RiE3769GY6C yIEtCSEyvEwUwSRW8O0eW2bfLI9syUXHEJi8IiSK+fSFN+bOKWA= =IsJ5 -----END PGP SIGNATURE----- --JVVqWhpkAs5raV7A--