How to turn off PHP error formatting for getting only plain text? This should also affect MySQL related functions.
I want to get plain text, instead of structured HTML error message.
UPDATE
AS Artefact2 suggested I need to modify php.ini file, so
ini_set('html_errors', false);
does the trick if I need it in realtime.
http://www.php.net/manual/en/errorfunc.configuration.php#ini.html-errors
Just set html_errors to "Off" in your php.ini.
Related
Im doing some webapp on php, im using my own MVC pattern, including Activerecord, and Twig templates.
So i have some problems with charset, there is some details about my encoding.
Im using polish characters
Mysql encoding is set to utf8_unicode_ci (i tried urf8_general_ci)
Twig template have standard html-5 header with utf8 encoding
Im not sure about files encoding (using netbeans), but sublime text 2 console on view.encoding() says: u'Undefined', i dont try to change it yet.
Problem description:
When im using polish characters like ółąćź in Twig template file - everything looks good, there is no problem. I tried to use:
echo $twig->render('hello.tpl', array('locations'=>"óóśąłłąś"));
And in this case is no problem too.
But when I get my data from database the polish characters are like "�"
I tried to get data by structural php mysql call, and by activerecord - ex. Model::all().
It allways have problems with characters from database in Twig template.
And yes, i set my active record config like: dbname?charset=utf8
The answer is funny.
I tried again to do it structural and i used this query:
mysql_query("SET NAMES 'utf8'", $dbLink);
It works, all characters are visible now.
On activerecord the problem still apears, so i updated activerecord to nigtly build, and everything works now !
I have problems about Magento.
I can't manage products or category. this just happen I don't know why.
when I click on manage categories it's not working as you can see this image
https://www.dropbox.com/s/zbikd3pfd3b116c/mj1.jpg?dl=0
any solution to resolve?
Hmmmm. What locale are you using? (See drop-down in bottom-left of the screenshot). I wonder if this is a double-byte character issue. I think maybe some JSON has been sent to the page but it has become corrupted possibly due to a double-byte character or some illegal or unescaped character in the JSON string.
If this just happened and you don't know why then:
a) Try some different locales from the drop down. If that doesn't help then:
b) Ensure all caches are cleared and refresh the page. If there is no change then:
c) I suggest you go to your last back up and recreate your website from that.
As mentioned it looks like the HTML of the page is all mixed up due to a malformed JSON string.
You could look at the returned content from the ajax call (using browser tools to study the response). That might give you a clue as to which part of the JSON string is corrupted. Maybe some part of the category attributes contains HTML tags which it shouldn't or there is a double-byte character or unescaped quotes in the JSON string - but that is just a guess. You might have to change your database settings and/or character settings to handle UTF16 characters.
Do all categories behave like that or just some of them? If it is only some of them then you might try deleting those categories and recreating them from scratch.
For the record I have never seen anything like this before.
solution a and b not working, then I re-install and restore sql database by phpmyadmin everything almost complete like before only when I go to Manage Categories then it's error.
There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: 682632812035
I'm not talking about using the parameter in the data template - I'm all set there. I need to know how to change the format of a parameter once it hits my RTF template.
I have
<?param#begin: p_Date?>
<? $p_Date?>
This gets my parameter from the report request page onto my report. However, I can't seem to alter the format. I'm sure I just need to understand how to access it, but I'm not that familiar with BI Publisher. I know I can alter the format on the request screen, and that flows through, but I need to alter it on the end result. Can anyone help?
Ok, I finally found it. You can use the format_date function; the documentation is a little sparse. My syntax looks like this:
<?xdoxslt:format_date($p_Date, 'MMM yyyy','MM-dd-yyyy', $_XDOLOCALE, $_XDOTIMEZONE)?>
The first parameter is the target format, the second is the input mask. The second can be overridden to use a specific l18n style.
This is more of a curiosity than actual problem as there is an easy and propably more preferable workaround. When using Codeigniters form validation and when displaying error message the CI user guide gives two ways to set one's own validation messages: through set_message-method and editing the language file which is located in the system folder.
However when editing the language file to contain error messages in my native language (which contains special character liks 'Ä' and 'Ö') the special characters are replaced with a black diamond. When using the set_message-method from form_validation it works without a problem and the characters are encoded with UTF-8 properly.
I am wondering where lies the problem when using the file instead of the method and how to solve it?
It sounds like the file is not saved by your editor as UTF-8. Make sure that it is.
I'm getting the error message: "Invalid byte sequence for encoding "UTF8": 0x9f
Ok, now I know somewhere my php app is trying to query using that 0x9f character.
But I have no idea WHERE.
I checked postgresql.conf but I didn't find anything like "log_on_error". There's only the log_statement parameter which causes postgres to log all selects or just all queries.
But what I would like to see is this:
ERROR: "Invalid byte sequence for encoding "UTF8": 0x9f
QUERY: SELECT * FROM blabla WHERE field1='blabla0x9f'
In this case I would be able to see which query caused this. So I know in which php script to check.
Is this possible with postgres? My psql version is 8.3.9.
You are looking for log_min_error_statement for that.
But "invalid byte sequence" comes in the parser before the text is even parsed into a statement. So there is no way to log that without risking logging it in a weird encoding and making it either useless or dangerous.
But presumable your PHP application detects the error? If not, you are not checking enough return codes there ;)
Just to be clear, because I don't think Magnus is getting through (though his answer is pretty good): If you read the file in UTF-8, but it is encoded in latin1 it doesn't magically get converted to utf8. You can only work with the file in the encoding of the file, whether submiting it to the db, or re-encoding it in a different encoding. You have three options (that I might use):
Of course, the right-most way is the first one.
Convert the file using php. Read the docs on recode for more information about this.
Change the client_encoding on postgresql, using set client_encoding = encoding. You can find the valid encoding in the docs
Send it to postgresql to be converted read the docs on PostgresSQL's convert()
Information about the php function recode`