<?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>Forem: Kalpesh Meniya</title>
    <description>The latest articles on Forem by Kalpesh Meniya (@kjmeniya).</description>
    <link>https://forem.com/kjmeniya</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%2F3593385%2F798ca82b-3341-4e51-bccc-e1f4de1d24be.png</url>
      <title>Forem: Kalpesh Meniya</title>
      <link>https://forem.com/kjmeniya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/kjmeniya"/>
    <language>en</language>
    <item>
      <title>DNA test confirms Dr Umar Nabi Bhat drove i20 that blew up near Red Fort</title>
      <dc:creator>Kalpesh Meniya</dc:creator>
      <pubDate>Thu, 13 Nov 2025 14:03:54 +0000</pubDate>
      <link>https://forem.com/kjmeniya/dna-test-confirms-dr-umar-nabi-bhat-drove-i20-that-blew-up-near-red-fort-1ilj</link>
      <guid>https://forem.com/kjmeniya/dna-test-confirms-dr-umar-nabi-bhat-drove-i20-that-blew-up-near-red-fort-1ilj</guid>
      <description>&lt;h2&gt;
  
  
  Forensic DNA Analysis Confirms Driver Identity in Red Fort Explosion: A Technical Deep Dive
&lt;/h2&gt;

&lt;p&gt;👋 Hi, I'm a data scientist interested in the intersection of technology and forensics.&lt;/p&gt;

&lt;p&gt;The recent explosion near the Red Fort in Delhi has been a subject of intense investigation. Law enforcement has now confirmed, through advanced DNA analysis, that Dr. Umar Nabi Bhat was the driver of the i20 vehicle involved in the incident. While news outlets are covering the story, let's delve into the technical aspects of how DNA evidence is used in such high-profile investigations. This isn't about the criminal case itself, but rather a look at the science behind the identification.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Power of DNA: A Unique Identifier
&lt;/h3&gt;

&lt;p&gt;DNA, or deoxyribonucleic acid, is the hereditary material in humans and almost all other organisms. Each person's DNA is unique, like a fingerprint (except in the case of identical twins). Forensic DNA analysis exploits this uniqueness to link individuals to crime scenes.&lt;/p&gt;

&lt;p&gt;The process typically involves:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Sample Collection:&lt;/strong&gt;  Biological material (blood, saliva, hair, skin cells) is collected from the crime scene (e.g., the i20 vehicle in this case) and from the suspected individual (Dr. Bhat).&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;DNA Extraction:&lt;/strong&gt;  The DNA is carefully extracted from these samples. This involves breaking open the cells and separating the DNA from other cellular components.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;DNA Amplification (PCR):&lt;/strong&gt;  Often, the amount of DNA recovered from a crime scene is minimal. Polymerase Chain Reaction (PCR) is a technique used to amplify specific regions of the DNA, creating millions of copies for analysis.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# This is a conceptual representation of PCR. The actual process involves specialized reagents and equipment.
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;PCR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;template_DNA&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;primer1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;primer2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cycles&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;amplified_DNA&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;template_DNA&lt;/span&gt; &lt;span class="c1"&gt;# Initial DNA template
&lt;/span&gt;    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;cycle&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cycles&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="c1"&gt;#Denaturation (heating to separate strands)
&lt;/span&gt;        &lt;span class="n"&gt;separated_strands&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;split_DNA&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amplified_DNA&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="c1"&gt;#Annealing (primers bind to strands)
&lt;/span&gt;        &lt;span class="n"&gt;primed_strands&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;attach_primers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;separated_strands&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;primer1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;primer2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="c1"&gt;#Extension (DNA polymerase builds new strands)
&lt;/span&gt;        &lt;span class="n"&gt;amplified_DNA&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;build_new_strands&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;primed_strands&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;amplified_DNA&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DNA Profiling (STR Analysis):&lt;/strong&gt;  Short Tandem Repeats (STRs) are specific locations (loci) on a chromosome that contain sequences of DNA that repeat consecutively.  The number of repeats at each STR locus varies from person to person. Forensic scientists analyze multiple STR loci to create a DNA profile.  The more loci analyzed, the more unique and reliable the profile.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DNA Database Comparison:&lt;/strong&gt; The DNA profile generated from the crime scene sample is compared to the DNA profile of the suspect (Dr. Bhat).  It is also often compared to DNA databases maintained by law enforcement agencies.  A match between the two profiles provides strong evidence that the suspect was present at the crime scene.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Statistical Significance and the Likelihood Ratio
&lt;/h3&gt;

&lt;p&gt;The strength of the DNA evidence is expressed as a likelihood ratio or a probability. This represents the likelihood of observing the DNA profile if the suspect &lt;em&gt;was&lt;/em&gt; the source of the DNA compared to the likelihood of observing the same profile if a random, unrelated individual was the source.  A high likelihood ratio (e.g., billions to one) provides very strong support for the conclusion that the suspect was the source of the DNA.&lt;/p&gt;

&lt;p&gt;In the context of the i20 explosion, the DNA match confirms Dr. Bhat's presence in the vehicle. The specific location within the vehicle where the DNA was found (e.g., steering wheel, seat) could provide further context to the investigation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ethical Considerations
&lt;/h3&gt;

&lt;p&gt;It's important to acknowledge the ethical considerations surrounding DNA databases and forensic analysis.  Concerns include privacy, potential for misuse, and the reliability of the technology in certain circumstances.  Robust regulations and quality control measures are crucial to ensure that DNA evidence is used responsibly and ethically.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Takeaways
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  DNA analysis is a powerful tool for identifying individuals in criminal investigations.&lt;/li&gt;
&lt;li&gt;  The process involves sample collection, DNA extraction, PCR amplification, STR analysis, and statistical comparison.&lt;/li&gt;
&lt;li&gt;  The strength of the evidence is expressed as a likelihood ratio.&lt;/li&gt;
&lt;li&gt;  Ethical considerations regarding privacy and data security are paramount.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;[Related Post: Understanding Data Encryption Techniques]&lt;/p&gt;

&lt;p&gt;What are your thoughts on the use of advanced technologies in forensic investigations? Share your insights below!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; forensics, dna, analysis, crime, technology, security&lt;/p&gt;

</description>
      <category>forensicdna</category>
      <category>dnaanalysis</category>
      <category>forensicscience</category>
    </item>
    <item>
      <title>Delete Google Adsense Account</title>
      <dc:creator>Kalpesh Meniya</dc:creator>
      <pubDate>Tue, 11 Nov 2025 21:41:42 +0000</pubDate>
      <link>https://forem.com/kjmeniya/delete-google-adsense-account-48m0</link>
      <guid>https://forem.com/kjmeniya/delete-google-adsense-account-48m0</guid>
      <description>&lt;p&gt;👋 Hi, I'm a full-stack developer sharing tips on managing your online presence.&lt;/p&gt;

&lt;p&gt;Deleting your Google AdSense account might seem daunting, but it's a straightforward process. Whether you're switching to a different monetization strategy, no longer need the account, or simply want to streamline your online presence, this guide will walk you through the steps. Let's dive in!&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Delete Your Google AdSense Account?
&lt;/h2&gt;

&lt;p&gt;Before we get into the "how," let's briefly cover the "why." Common reasons for deleting an AdSense account include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Switching Monetization Platforms:&lt;/strong&gt; You might be moving to a different advertising network that better suits your needs.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Low Earnings:&lt;/strong&gt; AdSense might not be generating sufficient revenue to justify the effort.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Website Shutdown:&lt;/strong&gt; If you're no longer running the website associated with your AdSense account, keeping the account active might be unnecessary.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Account Management:&lt;/strong&gt; Simplifying your online accounts for better organization.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites Before Deleting
&lt;/h2&gt;

&lt;p&gt;Before you initiate the deletion process, ensure the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Account Balance:&lt;/strong&gt; Your AdSense account balance should be less than the cancellation threshold. Google won't process payments for amounts below this threshold upon account closure. Consider reducing your balance by pausing ad serving or adjusting your settings.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Payment Hold:&lt;/strong&gt; Remove any payment holds on your account to allow for a smooth cancellation.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Alternative AdSense Accounts:&lt;/strong&gt; Close all other AdSense accounts you have before proceeding.  You can only have one account per publisher.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step-by-Step Guide to Deleting Your Google AdSense Account
&lt;/h2&gt;

&lt;p&gt;Here's a detailed guide on how to permanently delete your Google AdSense account:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sign in to your AdSense account:&lt;/strong&gt; Go to &lt;a href="https://www.google.com/adsense" rel="noopener noreferrer"&gt;https://www.google.com/adsense&lt;/a&gt; and sign in using the Google account associated with your AdSense account.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Navigate to Account Settings:&lt;/strong&gt; In the left-hand navigation menu, click on "Account" and then "Account information."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Close Account:&lt;/strong&gt; Scroll down to the bottom of the "Account information" page and click on "Close account".&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Read and Acknowledge the Information:&lt;/strong&gt; Google will present information about the consequences of closing your account. Read this carefully. It will explain how your data will be handled and any outstanding payments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Confirm the Account Closure:&lt;/strong&gt; Check the boxes confirming that you understand the terms and conditions of closing your account.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Choose a Reason (Optional):&lt;/strong&gt; Google might ask you to provide a reason for closing your account.  This is optional, but providing feedback can help Google improve their services.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Click "Close account":&lt;/strong&gt; Finally, click the "Close account" button to initiate the account deletion process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Confirmation:&lt;/strong&gt; You should receive a confirmation message indicating that your account closure request has been received.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Important Considerations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Irreversible Process:&lt;/strong&gt; Deleting your AdSense account is permanent. You cannot reactivate it. If you need AdSense again in the future, you will have to create a new account.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Account Data:&lt;/strong&gt; Google will retain some data related to your AdSense account for auditing and legal purposes.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Associated Google Services:&lt;/strong&gt; Deleting your AdSense account does not delete your Google account or any other Google services you use.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Payment Thresholds:&lt;/strong&gt; As mentioned earlier, ensure your balance is below the cancellation threshold to avoid losing any earnings.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  Deleting your AdSense account is a permanent action.&lt;/li&gt;
&lt;li&gt;  Ensure your account balance is below the cancellation threshold.&lt;/li&gt;
&lt;li&gt;  Follow the step-by-step guide to close your account correctly.&lt;/li&gt;
&lt;li&gt;  Understand the implications of deleting your account before proceeding.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What do you think? Share your approach below!&lt;/p&gt;

&lt;p&gt;[Related Post: Optimizing Website Performance for Better SEO]&lt;/p&gt;

&lt;p&gt;tags: google, adsense, advertising, webdev, tutorial, account-management&lt;/p&gt;

</description>
      <category>googleadsense</category>
      <category>adsenseaccount</category>
      <category>deleteadsense</category>
      <category>monetization</category>
    </item>
    <item>
      <title>HTML Decode vs HTML Encode – Complete Guide</title>
      <dc:creator>Kalpesh Meniya</dc:creator>
      <pubDate>Sun, 02 Nov 2025 21:23:39 +0000</pubDate>
      <link>https://forem.com/kjmeniya/html-decode-vs-html-encode-complete-guide-4733</link>
      <guid>https://forem.com/kjmeniya/html-decode-vs-html-encode-complete-guide-4733</guid>
      <description>&lt;p&gt;Welcome to the &lt;strong&gt;HTML Decode vs. HTML Encode&lt;/strong&gt; guidesss!&lt;br&gt;&lt;br&gt;
This article explains the differences between HTML encoding and decoding, how they work, and when to use each.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The contents here are based on the full article published on &lt;a href="https://www.meniya.com/blog/html-decode-vs-html-encode-complete-guide" rel="noopener noreferrer"&gt;Meniya.com&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What is HTML Encoding?&lt;/li&gt;
&lt;li&gt;What is HTML Decoding?&lt;/li&gt;
&lt;li&gt;When to Use HTML Encoding vs. HTML Decoding&lt;/li&gt;
&lt;li&gt;Common Use Cases for HTML Encoding&lt;/li&gt;
&lt;li&gt;Common Use Cases for HTML Decoding&lt;/li&gt;
&lt;li&gt;HTML Encode and Decode Functions in JavaScript&lt;/li&gt;
&lt;li&gt;Best Practices&lt;/li&gt;
&lt;li&gt;References&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In web development, HTML encoding and decoding are crucial for ensuring that content displayed on websites is rendered properly and securely.&lt;br&gt;&lt;br&gt;
Whether you’re dealing with user input or dynamic content, understanding the difference between encoding and decoding HTML entities helps ensure data safety and correctness.&lt;/p&gt;

&lt;p&gt;This guide will explain both concepts in detail and show when to use HTML encoding or decoding.&lt;/p&gt;


&lt;h2&gt;
  
  
  What is HTML Encoding?
&lt;/h2&gt;

&lt;p&gt;HTML encoding converts special characters like &lt;code&gt;&amp;lt;&lt;/code&gt;, &lt;code&gt;&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;amp;&lt;/code&gt;, and &lt;code&gt;"&lt;/code&gt; into their corresponding HTML entity codes.&lt;br&gt;&lt;br&gt;
It helps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Display HTML special characters properly&lt;/li&gt;
&lt;li&gt;Prevent XSS (Cross-Site Scripting) attacks by neutralizing malicious input&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;&lt;br&gt;
&lt;code&gt;&amp;lt;&lt;/code&gt; → &lt;code&gt;&amp;amp;lt;&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="ni"&gt;&amp;amp;lt;&lt;/span&gt;div&lt;span class="ni"&gt;&amp;amp;gt;&lt;/span&gt;This is a div&lt;span class="ni"&gt;&amp;amp;lt;&lt;/span&gt;/div&lt;span class="ni"&gt;&amp;amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What is HTML Decoding?
&lt;/h2&gt;

&lt;p&gt;HTML decoding is the process of converting HTML entity codes back into their original characters.&lt;br&gt;&lt;br&gt;
It’s used to display encoded HTML entities as readable text.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;&lt;br&gt;
&lt;code&gt;&amp;amp;lt;&lt;/code&gt; → &lt;code&gt;&amp;lt;&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;This is a div&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  When to Use HTML Encoding vs. HTML Decoding
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HTML Encoding&lt;/strong&gt;: When displaying user-generated or dynamic content to prevent HTML injection and XSS.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTML Decoding&lt;/strong&gt;: When rendering or displaying already encoded HTML safely in the browser.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Common Use Cases for HTML Encoding
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Displaying user input safely
&lt;/li&gt;
&lt;li&gt;Preventing XSS attacks
&lt;/li&gt;
&lt;li&gt;Displaying code snippets or special symbols&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;If a user submits:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hacked!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It can be encoded as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="ni"&gt;&amp;amp;lt;&lt;/span&gt;script&lt;span class="ni"&gt;&amp;amp;gt;&lt;/span&gt;alert(&lt;span class="ni"&gt;&amp;amp;#39;&lt;/span&gt;Hacked!&lt;span class="ni"&gt;&amp;amp;#39;&lt;/span&gt;);&lt;span class="ni"&gt;&amp;amp;lt;&lt;/span&gt;/script&lt;span class="ni"&gt;&amp;amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Common Use Cases for HTML Decoding
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Display previously encoded text in readable form
&lt;/li&gt;
&lt;li&gt;Render dynamic HTML that includes encoded entities
&lt;/li&gt;
&lt;li&gt;Convert encoded characters for display&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  HTML Encode and Decode Functions in JavaScript
&lt;/h2&gt;

&lt;p&gt;You can create your own functions or use built-in browser methods to encode and decode HTML entities.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTML Encoding Function (JavaScript)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;htmlEncode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;div&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  HTML Decoding Function (JavaScript)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;htmlDecode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;div&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerText&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Best Practices
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Encode user input&lt;/strong&gt; before displaying it.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use secure encoding methods&lt;/strong&gt; to avoid script execution.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use built-in browser methods&lt;/strong&gt; like &lt;code&gt;textContent&lt;/code&gt; and &lt;code&gt;innerHTML&lt;/code&gt; safely.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.meniya.com/blog/html-decode-vs-html-encode-complete-guide" rel="noopener noreferrer"&gt;Meniya.com Blog - HTML Decode vs. HTML Encode: Complete Guide&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>html</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>security</category>
    </item>
  </channel>
</rss>
