NetBeans Doesn't Display Chinese Content - php

Good day,
My dev pc env like this,
Win11 and NetBeans16 installed. I am dev PHP Lang now.
When I opened an existing source code folder and I found these Chinese content can't display normally.( Pls see screen capture posted as below)
I already tried several methods as below,
I configured the NetBeans Project Encoding to UTF-8; // doesn't work
I tried to type simple Chinese content in the IDE directly; // Same issue
I googled and modified the 'netbeans.conf' file and added the
-J-Dfile.encoding=UTF-8
at the end of netbeans_default_options=" , and then I restarted my NetBeans or enen I reboot my win OS. The problem is still can't resolve.
BTW,
I could view the Chinese content in Visula Studio Code via my PC.
And I configured my DB encode to UTF-8 Unicode (utf8mb4).
Thks for your suggestions in advance.

Followed Skomisa's suggestion. I solved the issue as below,
I must choose one font that support Chinese character and then I could render it in NetBeans edit window.(as I commented above)
See the result attached.

Related

Cyrillic characters messed up in .php webpage

All my files with .php extension and Cyrillic encoding that worked fine for years got messed up. Probably because of PHP server upgrade by hosting provider.
To illustrate the problem I wrote the simplest possible file which cannot have any errors:
http://reverent.org/testencoding.php
For some reason webpage defaults to unicode when viewed in a browser. If you go to view -> Text encoding and select Cyrillic(Windows) everything gets fine.
In contrast, exactly the same file with .html extension is displayed correctly right away:
http://reverent.org/testencoding.html
Any idea?
Now, I'm no expert on this, but this seriously reminds me of the exact issue I had. So.. personal experience, here goes (I'm sure this might help someone):
My issue was that my files on the server were set to windows 1251 by default instead of UTF-8, which I needed.. this caused these little beasts to appear: � in place of every symbol that wasn't just a basic letter or something like that. Coincidentally this is what your example looks like. And the encoding is the same. I fixed it by accessing the files with WinSCP and just switching the files to UTF-8 manually... ironically your file shows pretty much what I saw on my website.
There must be better ways to do this than WinSCP, but to be honest, this is the only time I've had to do this manually, so this is exactly what I clicked there (after opening the file):
You could also try to fix it with a meta tag to tell the browser which charset to use, but the files might be getting deformed the moment you save them, if their encoding is wrong.
<meta charset="utf-8">
This might not work for you, but it did work for me, so there's hope :)
Hope it helps or at least points you in the right direction :)
I just put the php.ini file with this single line 'default_charset = "windows-1251"' in the directory with the files with Cyrillic encoding. This overwrites server's php.ini which sets default charset to UTF.
Now everything is fine: http://reverent.org/ru/testencoding.php

Uploaded Image file name encoding/charset in Wordpress

I have a pretty weird problem that I have not faced before, and with a 2-hour search I had no results;
I recently migrated a wordpress site, what I did was;
Export database and import on new server (via phpMyAdmin)
Copy Wordpress client files to new database.
Edit wp-config.php relative to new database information.
Everything was working correctly, but only problem was, in new server some of images that is used in posts or as thumbnails are not showing in browser (probably due to Turkish unsafe chars).
As an example, if I inspect the link of the image, wordpress redirects me to 404 page;
File name: çiğ-beslenme-mi-yoksa-pişirmek-mi.jpg
How wordpress prints it:
wp-content/uploads/2017/01/%C3%A7i%C4%9F-beslenme-mi-yoksa-pi%C5%9Firmek-mi.jpg
How I can access it via browser:
wp-content/uploads/2017/01/c%CC%A7ig%CC%86-beslenme-mi-yoksa-pis%CC%A7irmek-mi.jpg
For example, for the char ç wordpress prints; %C3%A7 and it is accessible with c%CC%A7
As you can see, I can add a c letter before printing ç and change %CC%A7 with %C3%A7 or s before ş, this way, images gets shown again. But I would like to know what is the problem here, or what is the cause of this.
I would love that if there is anyone out there, have a better understanding on charsets illuminate me. I'm positive this would occur with German or Dannish also, since these languages has unsafe latin letters too.
Additional information;
Its a LAMP, no control panel software.
PHP Version 7.0.13-0ubuntu0.16.04.1
Apache/2.4.18 (Ubuntu)
mysqlnd 5.0.12-dev
PHP charset: UTF-8
Charset in mysql tables (?) utf8mb4_unicode_520_ci
If needed I can add more information in demand.

ZipArchive addFromString doesn't work properly on Windows

I have a server whch runs a little app that we use to create .docx.
It worked perfectly on an old server but I had to move it on another one and now it has a great problem: when I run my php script - based on PHPWord - the output files are broken and cannot be used (MS Word reports "The file xyz.docx cannot be opened because there are problems with the contents).
Also changing the file extension from .docx to .zip (just to take a look to its content) doesn't help.
The "funny" side of this problem is that on the same server, using the same version of PHP, with nginx 1.2.3 it disappears and the .docx file are perfect (ok, if don't care of the content... but this is another problem...).
I could switch on nginx but I have a different issue on it: I can't read Latin1 special chars as expected.
After having googled and searched into the code for a long while, I found that the problem is with the following line, contained in the Template.php library of PHPWord, lin 105:
$this->_objZip->addFromString('word/document.xml', $this->_documentXML);
It apparently works fine (and on nginx it really works fine) but it produces a fake .docx, impossible to open.
I tried different versions of the apache server with no luck, so I would really appreciate any help.
Summarizing:
I tested my script (which uses PHPWord) on a Windows Server 2003 host and php 5.2.8
It works fine with nginx
It produces a bad .docx file with apache (ZipArchive addFromString doesn't work)
I tested it using several Apache versions, from 2.0.64 up to 2.2.25
I can't see any error message
Any idea?
You can use PclZip instead of ZipArchive.
The sample code :
\PhpOffice\PhpWord\Settings::setZipClass(\PhpOffice\PhpWord\Settings::PCLZIP);

Redirection not working in CakePHP 2

I have an application and its working locally perfect.
on production, all pages are fine which haven't redirection.
Its connected with database because data showing on list pages
I have checked controllers/models for starting and ending code (spaces removed and closing PHP tag removed)
I checked permissions (all folders are 755 and tmp is 777)
I updated debug value to 2,3 but not showing any thing
I checked using PR few variables and in view source it shows few spaces (didn't get any clue that from where the spaces are embedding)
Also, I have uploaded fresh copy of lib/Cake
One another project in same version of Cake is already deployed and working perfectly (Prefix changed for both projects)
On redirection, it shows a blank page. I checked view source of this blank page and it contains 32 spaces.
Any Clue why its happening or from where I need to remove these spaces?
Issue fixed.
Because it was issue of IDE.
I am using sublime but same Dreamweaver have same issue.
For Sublime, we can load a package : https://github.com/SublimeText/TrailingSpaces
For Dreamweaver, we need to do manually by search and replace.
for more details : http://www.jaredstenquist.com/2009/02/13/removing-extra-linebreaks-and-spaces-in-dreamweaver/
Thanks

Accentuation problems with .php extension

I'm having some problems with accentuation and special characters on my website.
The problem only occurs on my webhosting (I've another website on the same hosting account, this one with the issue is in a sub folder, and the main website works well), on local with Wamp Server everything is OK.
So, my problem is: with .php extension accents aren't showed correctly but if I only change the file extension from .php to .html every accents are OK.
Edit:
I found my problem... I changed my code editor from notepad++ to sublime text and now it works.
It's strange because it was working well with wamp and in a free webhosting but not on my main hebhosting :/
Anyway, thank you very much for your help.
header('Content-type: text/html; charset=utf-8');
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Note that, depending on where the text comes from, you might have to check some other things too (database-connection, source-file-encoding, ...) - i've listed a lot of them in one of my answers to a similar question.
In accordance with the similar issue
Charset=utf8 not working in my PHP page
you need to use ASCII character
And is your content type correctly set?
I searched for you: you can use this: é (ascii 130)

Categories