/    Sign up×
Community /Pin to ProfileBookmark

json_encode utf8 problem

Hi everyone

<?php echo json_encode(utf8_encode($this->recipe[‘recipe_name’]), JSON_ERROR_UTF8); ?>

$this->recipe[‘recipe_name’] is calling a Mysql Database data,

and the output in the web file as just quotation.

at this point, I’ve looked at various tutorials and I can’t figure out what is the problem.

help?

Thanks!

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMar 19.2013 — I believe JSON_ERROR_UTF8 only has meaning within the context of the return value from json_last_error() (see example 1).
Copy linkTweet thisAlerts:
@A123SchmidtauthorMar 19.2013 — how do I show the the data in the database?

I have tried many json_encode JSON_ERROR_UTF8 etc. and not working at all.

I have it reading a post name with hyphens to replace spaces.

how do I have the url to handle hyphens for SEO purposes in php MVC format?
Copy linkTweet thisAlerts:
@NogDogMar 19.2013 — I think I need an explanation of what you're ultimately trying to accomplish with all this encoding? If it's just to get it to work in a URL, perhaps all you need is url_encode()?
Copy linkTweet thisAlerts:
@A123SchmidtauthorMar 19.2013 — in my MySql database, I have url slugs, to replace spaces with hyphens, and I wan't it to read by that column with those slugs, and its not reading that certain row, or not displaying the content, and I need some help on how to make that work
×

Success!

Help @A123Schmidt spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...