<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Abolade Eniseyin</title>
    <description>The latest articles on DEV Community by Abolade Eniseyin (@heniisbaba).</description>
    <link>https://dev.to/heniisbaba</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F390391%2F5c536421-36a2-4c0b-ac86-e0dacfe486f4.png</url>
      <title>DEV Community: Abolade Eniseyin</title>
      <link>https://dev.to/heniisbaba</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/heniisbaba"/>
    <language>en</language>
    <item>
      <title>U+FEFF (Zero-width space)  - Fighting an invisible bug.</title>
      <dc:creator>Abolade Eniseyin</dc:creator>
      <pubDate>Sat, 30 Jan 2021 00:18:14 +0000</pubDate>
      <link>https://dev.to/heniisbaba/u-feff-fighting-an-invisible-bug-31gn</link>
      <guid>https://dev.to/heniisbaba/u-feff-fighting-an-invisible-bug-31gn</guid>
      <description>&lt;p&gt;Image credits: &lt;a href="https://earthwatch.org/"&gt;earthwatch2.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So this is my first article here (anywhere) but I'll be brief.&lt;/p&gt;

&lt;p&gt;I started the day high on energy, geared up to once and for all finish this feature that has taken too long. Who would have guessed I would be where I started Nine hours after 🤧.&lt;/p&gt;

&lt;h3&gt;
  
  
  So what is FEFF?
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;The zero-width space (​), abbreviated ZWSP, is a non-printing character used in computerised typesetting to indicate word boundaries to text processing systems when using scripts that do not use explicit spacing, or after characters &lt;strong&gt;&lt;em&gt;(such as the slash)&lt;/em&gt;&lt;/strong&gt; that are not followed by a visible space but after which there may nevertheless be a line break. It is also used with languages without visible space between words, for example Japanese. Normally, it is not a visible separation, but it may expand in passages that are fully justified. &lt;br&gt;
-- &lt;a href="https://en.wikipedia.org/wiki/Zero-width_space"&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://dj.microlise.net/zeroban"&gt;Here&lt;/a&gt;, a simple explanation of this character and a tool to remove ZWSP in strings.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The presence of zero width space (ZWSP) can interfere with URLs, usernames and passwords.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  How did this affect my day?
&lt;/h3&gt;

&lt;p&gt;Well, unbeknown to me, the endpoint (url) I copied and pasted into my code (yeah I know, bad practice) had the zero-width space included. It looked just like this &lt;code&gt;services/providers&lt;/code&gt; but it was &lt;code&gt;services​/providers&lt;/code&gt;. &lt;br&gt;
Of course no visual difference (copy and see). &lt;/p&gt;

&lt;p&gt;On calling the endpoint I repeatedly got a 405 from the api server but the curl example in the documentation worked perfectly in the terminal 😱. So what went wrong?&lt;/p&gt;

&lt;h3&gt;
  
  
  POSTMAN to the rescue
&lt;/h3&gt;

&lt;p&gt;I dumped &amp;amp; copied my generated url string and used the same in postman to hit the endpoint directly and the error remained.&lt;/p&gt;

&lt;p&gt;.&lt;br&gt;
.&lt;br&gt;
.&lt;/p&gt;

&lt;p&gt;After taking a rest, I remembered Postman Console and checked it, Alas! I discovered a strange addition to my url.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;services%E2%80%8B/airtime%E2%80%8B/request?&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;🏃🏻‍♂️🏃🏻‍♂️🏃🏻‍♂️ Stack overflow and others &lt;/p&gt;

&lt;p&gt;No mention of such issue with my web framework &lt;strong&gt;[Laravel]&lt;/strong&gt;, a quick look up of Utf-8 reference sheet &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1QKpQOSu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fshifsmqrkpgre8hlkfq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1QKpQOSu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fshifsmqrkpgre8hlkfq.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So we have a clue, we know what the issue is but how do we know what added zero-width space to the string. Another rest was in order as this was already driving me crazy.&lt;/p&gt;

&lt;p&gt;Back again&lt;br&gt;
&lt;a href="https://laracasts.com/@manojow"&gt;@manojow&lt;/a&gt; on &lt;a href="https://laracasts.com/discuss/channels/general-discussion/laravel-adds-weird-characters-at-the-beginning-of-a-saved-html-file"&gt;Laracast&lt;/a&gt; gave this answer to similar issue, this provided a way to solve the issue, but you know we still need to understand the source of the issue right?&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5WMGXbYA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/iucd1ymufr9suvv0pgj5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5WMGXbYA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/iucd1ymufr9suvv0pgj5.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This answer displayed above gave me another name to search for. &lt;code&gt;U+FEFF&lt;/code&gt;.&lt;br&gt;
So we know the character is coming from somewhere outside the framework, as no such bug was reported by the thousands using Laravel's http facade.&lt;/p&gt;

&lt;p&gt;Off I went for launch at 5pm, coming back it occurred to me to that this must have been because I copied all the endpoints. So I decided to type it instead and voila! - It worked.&lt;/p&gt;

&lt;p&gt;This was supposed to be simple but it ended up wasting a ton of my time today. Silly in the end &lt;strong&gt;😪&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So lesson learned: &lt;strong&gt;Be careful what you copy&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So we end this with the advice of &lt;a href="https://www.freecodecamp.org/news/author/eumir/"&gt;Eumir Gaspar&lt;/a&gt; in his post about &lt;a href="https://www.freecodecamp.org/news/a-quick-tale-about-feff-the-invisible-character-cd25cd4630e7/"&gt;FEFF&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you do ever encounter an error like that, be sure to look for hidden characters not shown by your editor.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Did I keep my promise to be brief?.&lt;br&gt;
See you 🖖.&lt;/p&gt;

&lt;p&gt;Before I forget, we have a frog in the cover image if you didn't notice 😀.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>bugs</category>
      <category>utf8</category>
      <category>weird</category>
    </item>
  </channel>
</rss>
