Post by IP_CAM » Mon Oct 07, 2019 9:13 am

A possibly useful tool, it found and modified about 490 xx.js Files in one of my Testshops.
found here: https://for-opencart.com/must-be/utf-8-bom
---
Image
---
https://dzone.com/articles/what-does-utf-8-bom-mean
Believe it or not, There is no such thing as Plain Text!
All files in a modern Operating Sytems (Windows, Linux, or MacOSX) are saved with an encoding scheme! They are encoded (a table mapping of what each byte means) in such way so that other programs can read it back and understand how to get information out. It happens that US/ASCII encoding is earliest and widely used that people think it's just "Plain Tex". But even ASCII is an encoding! It uses 7 bits in mapping all US characters in saving the bytes into file. Obviously you are free to use any kind of encoding (mapping) scheme to save any files, but if you want other programs to read it back easily, then sticking to some standard ones would help a lot. Without an agreed upon encoding, programs will not able to read files and be any useful!
The most useful and practical file encoding today is "UTF-8" because it support Unicode, and it's widely used in internet.
I discovered something odd when using Eclipse and Notepadd++. In Ecilpse, if we set default encoding with UTF-8, it would use normal UTF-8 without the Byte Order Mark (BOM). But in Notepad++, it appears to support UTF-8 wihtout BOM, but it won't recoginze it when first open. You can check this by going Menu > Encoding and see which one is selected. Notepad++ seems to only recognize UTF-8 wihtout BOM with ones it converted by it's own conversion utility. Perhaps it's a bug in notepad++.
So what is BOM? The byte order mark is useless for UTF-8. They only used for UTF-16 so they know which byte order is first. But UTF-8 will allow you to save these BOM for conversion purpose... they are ineffective in encoding the doc itself. So a "normal" UTF-8, it won't have BOM, but Windows would like to use them anyway. The Windows NOTEPAD would automatically save BOM in UTF-8!
So be-aware when viewing UTF-8 without BOM encoding files in Notepad++, as it can be deceiving at first glance.

Attachments

opencart_BOM_cleaner.png

opencart_BOM_cleaner.png (138.98 KiB) Viewed 686 times


I don't use Forum Mail, to reach me, contact: jti@jacob.ch
-
Server Q & A Basic Information on Code + Settings
http://www.everyauction.info/serverinfo.html
Demoversion OpenCart LIGHT v.1.5.6.5
http://www.jti.li/shop/
1'400+ FREE OC Extensions - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
-
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by webdesires » Fri Nov 22, 2019 7:55 pm

BEWARE USING THIS!!

IT will search over all files in opencart on EVERY page load, not the best for performance. And personally I have never had this issue anyway?? Configure your editors correctly and you should never need such insane work-arounds.

If you do seriously need this, put it in a controller somewhere you can run manually away from everything else.

Regards, WebDesires.
We are a team of developers in the UK - professional and friendly, message us or give us a call anytime and we will be happy to help.

Phone: +44 (0) 121 318 6336 - Web: webdesires.co.uk - Skype: WebDesires
OpenCart Support - OpenCart Web Development - Our OpenCart Plugins


User avatar
Active Member
Online

Posts

Joined
Mon Sep 28, 2015 6:34 pm
Location - West Midlands, United Kingdom

Post by IP_CAM » Fri Nov 22, 2019 10:41 pm

Well, it's a simple standalone File Tool, placed into the ROOT Section, likely
to be used once, after everything on Code is placed on a Server, like a few other such
tools I frequently use, as shown on the image below. But it has absolutely no connection
or relation to a running shop, it only searches for and fixes it's incorrectly saved files. :laugh:
And it found a few files, created by some so-called Dev's, unaware of what they're doing,
as it can be seen in the Image, placed in the Zip File Download as well. I cannot judge on
how important that might be, and/or what the consequences such a file 'setting' could have,
but for some reason, that BOM 'setting' is obviously required to meet some Standards,
or it would not exist. ;)
---
Image

Attachments

bom.jpg

bom.jpg (29.87 KiB) Viewed 140 times


I don't use Forum Mail, to reach me, contact: jti@jacob.ch
-
Server Q & A Basic Information on Code + Settings
http://www.everyauction.info/serverinfo.html
Demoversion OpenCart LIGHT v.1.5.6.5
http://www.jti.li/shop/
1'400+ FREE OC Extensions - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
-
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 4 guests