rssLounge weird issue with greek characters - php

I have just installed rsslounge 1.7 but I am experiencing a wierd issue.
When rsslounge loads, everything seems ok, but when the rss elements are refreshed (for instance I click on a category on the left), the rss elements's contents turn into "?". This behaviour is happening on Greek characters only.
How can I fix this?

I came across the same problem and fixed it by changing a single line:
http://code.google.com/p/rsslounge/source/browse/trunk/application/controllers/ItemController.php#80
Replace it with the following one:
'html' => $this->view->render('item/list.'.Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->getViewSuffix()),
Basically, you remove the utf_encode/decode calls...
This isn't a perfect full solution (other small problems remain), but you at least get a functional rss reader ;).
Edit: Go to config/config.ini and add the following line:
resources.db.params.charset = "utf8"
This should fix everything (your old rss items will not be printed correctly though).

Related

Why is this html code not correctly interpreted?

I am a bit curious about this HTML code (Firebug's view):
<td>1–1 of 1 record found matching your query (RSS | history):</td>
I was trying to install refbase. I used the snapshot version because of SQL problems with the current release. While testing I got this view (Firebug console is opened on purpose to show how the code is interpreted, but I see the same on chromium for instance):
.
.
Then I clicked in the firebug view and added a single space character somewhere, and did escape to let it as it was. But after having added the space, the view changed into this:
.
.
So basically I changed nothing but the code is now correctly interpreted. That's really weird. I googled a bit about this, but I think I might not have found the appropriate keywords.
Could someone explain me the reason behind this weird behaviour and how to fix it? BTW this Here is the complete php source producing this page. Look on line 796.
EDIT:
Thanks to LGSon I noticed that it is a Firebug's trap: it interprets the & stuff to show nice html code and then when you edit-it, it becomes the real code. That's tricky indeed, but when checking page source you can see the real HTML:
<td>1&#8211;1 of 1 record found matching your query (<a href="rss.php?where=title%20RLIKE%20%22physics%22" title="track newly added records matching your current query by subscribing to this RSS feed">RSS</a>&nbsp;|&nbsp;<a href="query_history.php" title="recall a previous query from your current session">history</a>):</td>
It should be 1–1
Sample
1–1

Stubborn Byte Order Mark in cakephp

I know there are a lot of questions on this topic, I've been reading and trying different ideas for hours.
I'm fetching data using the Dropbox api, which works fine, but it's slow.
So I'm moving this fetch to ajax.
The json response has the ever popular invisible question mark appended to the end of the string... after the closing square bracket.
.....}]?
This makes the json object invalid and none of the regular functions work on invalid json.
It's there when I load the page direct, but goes away when I set autoRender to false. So I got it working.... but, I would like to find this little POS and remove it before it shows up randomly in the future. It took hours to figure out that this was problem because it's invisible!
I can use Notepad++ to eradicate the little beasty, but I can't find it!
I've tried the following...
grep -rlI $'\xEF\xBB\xBF' .
Total Commander -> go to project's root dir -> find files (alt+f7) -> file types . -> Find text "EF BB BF" -> check 'Hex' checkbox -> search
search in project for charset=iso-8859
Tried this hack
$response = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $response);
I use Netbeans which near as I can tell is worthless for this problem.
Keep in mind, this is Cakephp 2.3, so there are about 3.7 million files that get loaded.
How do you find these things??

Mysterious 1 when using php include

My backup content (should the database fail) is brought in with include(). For some reason, there's a mysterious lone '1' below the div the include is wrapped in. It does it every time, but just on the content include. I've checked the function, all pages involved, no stray 1. If it loads from the database, everything's fine.
Any ideas why?
(empty($Content)?(empty($dbContent)?include($URL):$dbContent):$Content);
That's the core of the function. No code to provide really, just a strange 1.
Apparently it was the nested ternaries causing the issue. It outputs a 1 right after the function, as if it were saying echo include()
Very odd, because the rest of the functions seem to be working fine. The only difference is the include().
I'll switch back to longhand if any more odd behavior appears. It would be nice to know why it was treating it like it had echo in front of it.

Ethiopic font returned by 'echo' and 'printf' is not visible

Edit:
when I use something like
echo 'coming up is ethiopic font: እናመሰግናለን';
It works fine
but when there is some ethiopic string returned by function as shown below, the returned string is not visible.
echo 'coming up is ethiopic font:'.my_string();
when my_string() returns some ethiopic font, that part will not be visible.
Is there any global setting with PHP? or what can I do ?
As you can see at the footer of the page at here the font is partially visible(it is visible at least if you have the fonts on your pc).
The problem apeared on my host server, but no problem on my local server
EDIT:
My problem seems something different from the php functions. I tried relocating the code from the side bar to the header section, and the same code works fine in the header section, but not in the sidebar. Therefore, I am suspecting something else. I added CSS and HTML tags to the question.
Thank you.
It is possible problem with encoding. I once had similar issue using Hindi and bengali font. It was solved by playing with some javascript font library and string utf8_encode ( string $data ). We later replaced it with alternative solution, by embedding css3 web-fonts. CSS3 allows for web-fonts, which is a good solution to such problem.

strange thing, ajax response includes whitespace

I ave several JS functions that call different php files with $.ajax jquery method... yesterday everything was fine, but after cleaning up my code, i don't know what i did, but now the ajax response is like "[space]data" instead of "data"..
i could use a trim function in Js but i want to fix the source of the problem...
all my php files have the missing last ?> in order to avoid that, and before <?php i'm sure, just checked, there is no space...
how come did I introduce this error? is the server? the browser?
The funny thing is that yesterday i cleaned my code with JSLINT..! bad idea..
thanks
When I had the same problem it was just a carriage return or space after the closing PHP tag, a surprisingly easy thing to introduce by accident.
Make sure you open the PHP tag at the start of the first line of your script, close it at the end and delete everything after the closed tag (should be easy to spot in a good editor).
I can see no reason why not closing your PHP tag wouldn't just be really annoying.. but thats just me!
I know I'm late this this thread, found it because I had the same issue. I was able to confirm that the although you may clear all the spacing in your callback function it is still possible to get these white-space/carriage returns in your response text (you can even see this in chrome developer tools under the "Network" tab).
So I tested and found that if you put ob_clean(); at the top of your callback function then it clears any of those spaces. I don't know much about this function just that it was mentioned in the codex (http://codex.wordpress.org/AJAX_in_Plugins#Debugging). Hope that helps anyone else that find there way here because of the same issue
If your response from the server includes the extra space, then the php code is the cause. If your response does not include the extra space, then the problem must be in javascript.
Use Fiddler to examine the actual response from the server to see if it really has the space in it. You'll then know for sure if the problem is with PHP or JS. Then you can post the relevant code.

Categories