Skip to content

Commit

Permalink
fix encoding issue
Browse files Browse the repository at this point in the history
fiels retrieved from HTTP (Net::HTTP.get) are detected as ASCII-8BIT instead of UTF-8
  • Loading branch information
azi-acceis committed Jul 24, 2023
1 parent 95de0ad commit ad22728
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions _head.rhtml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%#-*- coding: utf-8 -*-%>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AVCS repository</title>
Expand Down
1 change: 1 addition & 0 deletions _navbar.rhtml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%#-*- coding: utf-8 -*-%>
<nav class="navbar is-fixed-top is-dark" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="https://pentest.pages.acceis.lan/prez/">
Expand Down
5 changes: 3 additions & 2 deletions index.rhtml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%#-*- coding: utf-8 -*-%>
<!DOCTYPE html>
<html class="has-navbar-fixed-top">
<head>
Expand All @@ -13,7 +14,7 @@
<div class="box">
<h3 class="title is-3" id="snippet-<%= snip['number'] %>">Snippet n°<%= snip['number'] %></h3>
<div class="block">
<pre><code class="language-<%= snip['code']['lang'] %>"><%= Net::HTTP.get(URI(snip['code']['vuln'])) %></code></pre>
<pre><code class="language-<%= snip['code']['lang'] %>"><%= Net::HTTP.get(URI(snip['code']['vuln'])).force_encoding('UTF-8') %></code></pre>
</div>
<div class="block">
<details>
Expand All @@ -25,7 +26,7 @@
</div>
<div class="block">
<b>Fixed code:</b>
<pre><code class="language-<%= snip['code']['lang'] %>"><%= Net::HTTP.get(URI(snip['code']['fix'])) %></code></pre>
<pre><code class="language-<%= snip['code']['lang'] %>"><%= Net::HTTP.get(URI(snip['code']['fix'])).force_encoding('UTF-8') %></code></pre>
</div>
<div class="tags">
<% snip['keywords'].each do |kw| %>
Expand Down
2 changes: 2 additions & 0 deletions render.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

require 'erb'
require 'json'
require 'net/http'
Expand Down

0 comments on commit ad22728

Please sign in to comment.