Whitebox appears in text in Google Chrome on Windows - windows

Here's what I know so far:
Browser: Google Chrome 56+
OS: Windows 10
The issue is in the picture, a white box appears inline with the text. When you inspect it the inspector shows a box character. I have tried on Chrome 55 and under and there is no issue. It's on the home page of our site, so people are quickly noticing it. Nothing in IE. Any ideas?

EDIT: Stack Overflow removes special characters, so the code snippet below does not work. See http://codepen.io/dennishall/pen/pRMxbJ for a working example.
EDIT 2: This S.O. post to find non-ascii characters should put you on the right track to find the problem file, if it's in your source code .. if not, it's in the CMS, and you should be able to figure out what record & field is the offender. -- How do I grep for all non-ASCII characters in UNIX
var stringWithSpecialCharacter = "find your";
document.getElementById('example-output').innerHTML = 'regular space char code = ' + stringWithSpecialCharacter.charCodeAt(4) + ' special character code for the following empty space = ' + stringWithSpecialCharacter.charCodeAt(5);
<div id="example-output"></div>
You have a special character in your source code (or CMS). Check your source code. This might be from copy/paste from a Word doc or similar.

Related

ckeditor soft return (shift-return) adds unknown character to HTML?

When using shift-return to add a soft return to ckeditor (version 4.5.3), and the resulting HTML is converted to PDF via wkhtmltopdf, there are "?" characters that are sometimes inserted at the start of the lines with soft returns.
Examining the HTML source, I find that there are 3 hidden characters inserted that wkhtmltopdf is converting to "?" since it doesn't know what to do with them. These characters don't show up in Notepad++ when "Show hidden characters" is turned on, but examining the file with a hex editor shows the are hex codes:
E2 80 8B
Why does ckeditor insert these hidden characters when you use a soft break, in addition to the <br /> tag? What is their purpose? And more importantly, is there a way I can disable this behavior? Or perhaps this is a bug?
UPDATE
I have duplicated the behavior using the current online ckeditor demo.
Type a few characters (like "asdf") on several lines, using shift-return to do a soft return between each line. Then click on the "Source" button to view the HTML. Select and copy an area large enough to more than fully contain the area you typed (make sure to copy a little extra below what you added). Then paste it into an online hex editor:
https://hexed.it/
You will see the same characters:
E2 80 8B
Please let me know if this is a bug. If not, what can I do to disable this behavior?
On the ckeditor bug report area, I was informed that the correct way to get "clean" HTML from ckeditor is to use:
editor.getData();
NOT what I was using:
editor.document.getBody().getHtml();
Posting here so others can easily find this, as the ckeditor documentation doesn't really help much.

CKEditor enable special characters (its stripping them)

Im using CKEditor as a part of Grocery Crud (this is a php codeignihter crud setup), which uses CKEditor (3.6.5) to edit text fields.
So the problem im having is, some special characters (like Ā) gets somewhat stripped from CKEditor (this happens in the latest version too). Can someone help me make sure these special characters gets treated correctly (specially if there is any flags that i can set maybe)?
To test, just open up a CKEditor anywhere (use the Full demo on the CKEditor website), click the "source" button (to see html mode), then paste the following in the editor: Ā. Then click the source button again (to see the wysiwyg mode) and you will see a Letter A with a line above it. Then click the source again (to see html mode) and you will see that the characters you entered Ā have been replaced by the Letter A with the line above it.
Any thoughts about keeping CKEditor from stripping out the character codes?
The above only happens for some special characters (ones that uses decimal or hex codes) and not others which is a bit strange. And some character codes (that uses hex/decimal) get changed to some other codes (that has non hex/decimal alternatives, which is strange but atleast you end up with the same result).
Alright, let me answer my own question.
You need to add the following to the config:
config.entities_processNumerical = true;
In the case of grocery crud, this is done on the following file: /assets/grocery_crud/texteditor/ckeditor/config.js
More doccumentation can be found here: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.entities_processNumerical
To be fair though, im surprised this is not enabled by default. Not quite sure why.

Regarding shift + enter with ckeditor inserting invisible character

I am using CK editor 4.4.6.
It seem on the first instance of pressing shift + enter, the editor inserts an invisible character. Upon submission, the character saves as a question mark. I can't see the character in the form submission when viewing the debug in the browser or the source code in the WYSIWYG editor itself. I do however notice when I press the right arrow that the cursor pauses at this character even though I can't see it. The page is being served in UTF-8.
This character is zero-width-space and is used by CKEditor to workaround Safari's and Blink's problems with placing selection inside empty inline tags or around them or in couple of other positions.
However, this character should never end up in data. It's used only internally and it is removed when getting data from editor. So, if you can find it in your database it means that you either get data from editor incorrectly, or you encounter some bug in the mechanism I described. In the latter is true please report a bug on http://dev.ckeditor.com, but please also describe how you reproduce it.
Looks like the editor is inserting character 8203.
What's HTML character code 8203?
I don't want to mess with the editor script at the moment so I'm just stripping out that character in the future on form/ajax post.

Remove spaces from a string of text in clipboard

This is maybe a weird request but hear me out:
I have a huge database at my shop containing product codes, like 87 445 G 6 which I need to check for availability on a supplier's website. The problem is, the supplier's website consists of a web form in which I have to enter the code without spaces, so imagine that I have to manually delete spaces every time I paste a code or write it manually without.
I can't edit the database from which I copy the codes.
I wonder if some sort of plugin, script, or trick can be used directly in browser on the supplier's web form, or some software to modify how the windows clipboard works, maybe some option to copy text without spaces. Using Windows XP.
The OP has probably moved on, but for anyone else looking here, my approach was to tackle this from the windows clipboard side.
For background: I keep a list of my credit card info in Keepass. Sometimes (poorly coded) shopping cart checkout forms don't like spaces in between card numbers. I like storing them with spaces since it's easier to read off that way.
There's various Windows clipboard utilites out there, but it took me a while to find one that could do some processing on the clipboard contents and pasting it out - Clipboard Help and Spell
The program has a way to "save" a bunch of text transformations, and even assign the action to a hotkey.
For reference, my "Find and Replace" action is to find "\s" (without quotes) and leave the Replace textbox empty. "\s" will match whitespace character.
Use the javascript console
You could use the javascript console for your browser to edit the textarea after you paste.
Using Google Chrome (or Firefox)
Paste your text in the text area.
Right click the text area and click Inspect Element
Look at the id for the element
Now switch to the console view
then run these lines (making sure to replace with 'the-id' with your id)
var my_text_area = document.getElementById('the-id'); // Put your id in here
my_text_area.value = my_text_area.value.replace(/ /g,"") // Deletes just spaces
It's even simpler if you have access to jQuery:
$('#the-id').val($('#the-id').val().replace(/ /g, ""))
The replace function is simply using regular expressions to convert spaces to nothing. If you want to replace all whitespace (including newlines) you would use .replace(/\s/g,"").
For firefox, the names are the same but the UI is a little bit different.
Use greasemonkey
You can either write a greasemonkey plugin or try to find one that fits your needs.

Margins Incorrect in Word Document after pasting from one document to another using VB6

I have inherited a VB6 app and I could do with some help with part of it.
The code opens a word document and copies its contents. Once this is complete it will open another document and paste the contents from the first document into the second. The opening, copying and pasting works ok, the issue comes with the formatting of the pasted text and the section break it follows. Instead of appearing straight after the section break it is being put on another page, the section break does however still say it is continuous. I've done some digging and tried what it says in the following
Stop Margin Adjustment when pasting - Microsoft Community
Problems with margins when I copy and paste a document into template - Microsoft Community
Section break causes unexpected page break in word
Troubleshoot page breaks and section breaks - Word - Office.com
None of these have helped. A cut down version of the code is as follows:
GetWord97Object objWordApp
objWordApp.Visible = True
objWordApp.documents.Open strCopyFromDoc
DeleteHeadersAndFooters objWordApp.documents(strCopyFromDoc)
objWordApp.documents(strCompyFromDoc).content.Copy
objWordApp.documents.Open strCopyToDoc
objWordApp.documents(strCopyToDoc).characters(objWordApp.ActiveDocument.characters.Count).Select
Set objRng = objWordApp.ActiveDocument.content ' Range used so as not to overwrite original text
objRng.Collapse Direction:=0
If IsWordAppVersionLessThan2002(CInt(objWordApp.Version)) Then
objRng.Paste
Else
objRng.PasteAndFormat wdPasteDefault
End If
I've tried the paste and format but that hasn't helped.
The version of Word I am using is 2002 SP3 but I need it to work with 2002 and up. The VB6 is at SP6.
Thanks in advance for your help.
I've managed to get rid of the problem. It looks like it was something to do with the document, rather than the code. I've given copying the header and footer from one document to another and that seems to have worked this time. Previous attempts at copying didn't seem to make any difference. Not an ideal solution but at least it is sorted.
I've found the solution and It's more simple that I thought. Just save the document before you paste your content. That makes Word to keep the original margins definitions. In my code I did that.
Private Sub CommandButton4_Click()
Dim Item As String
Dim i As Integer
For i = 0 To ProcList.ListCount - 1
Dim docNew As Document
Dim docproc As Document
Set docNew = Word.ActiveDocument
docNew.Content.Copy
Set docproc = Documents.Add
With docproc
.SaveAs FileName:=ProcList.List(i)
Selection.ClearParagraphAllFormatting
Selection.Paste
End With
Next i"

Resources