Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Daniele Futtorovic Newsgroups: comp.lang.java.programmer Subject: Re: java.net.URLEncoder.encode + UTF-8 (rant) Date: Mon, 14 Nov 2016 20:05:59 +0100 Organization: A noiseless patient Spider Lines: 17 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Mon, 14 Nov 2016 19:05:29 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="9c59bd208e091be8a86efe80203a618e"; logging-data="29181"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/FEOjxwWITCju7mRDK+sd7" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 In-Reply-To: Cancel-Lock: sha1:F3eOLKJujq8IaJBkELL1embuDGo= Xref: csiph.com comp.lang.java.programmer:35896 On 2016-10-17 14:38, Andreas Leitgeb wrote: > > > This method should (according to the w3c) only be used with UTF-8 > and UTF-8 is always supposed to be supported by Java. > > Why is there no java.net.URLEncoder.encodeUTF8(String s) that > would free me from that boring > try {...} catch (UnsupportedEncodingException ign) {...} > boilerplate? (What code do good(tm) Java programmers even put > into this catch clause, that is expected to never run, anyway?) throw new AssertionError( ing.toString() ); But yeah, it's annoying. df.