Comments (14)
I added $dbh->exec("set names utf8");
in PDO, and got:
[message] => ��快��
��快��
��快��
��快��
from phplist-plugin-restapi.
is your database UTF-8 enabled?
from phplist-plugin-restapi.
Yes, I can replicate this issue. I will see if I can do something about it
from phplist-plugin-restapi.
Remove the "utf8_encode" on this line, and it should work.
Change the line to
$result[$key] = $value;
from phplist-plugin-restapi.
from phplist-plugin-restapi.
I patch it, but still not work.
I am pretty sure the data is UTF-8 in my database.
Because it works fine and show correctly in PHPList.
I am add a function in phpListRESTApiClient.php to test it:
+ public function campaignGet($camp_id)
+ {
+ $post_params = array( 'id' => $camp_id );
+ $result = $this->callAPI('campaignGet', $post_params);
+ return $result;
+ }
And I got the JSON:
id: "2",
subject: "???? ~",
fromfield: "[email protected]",
tofield: "",
replyto: "",
message: "????? ?????",
textmessage: "",
footer: "",
entered: "2015-09-17 09:29:20",
modified: "2015-11-24 22:33:24",
from phplist-plugin-restapi.
Hmm, that's strange. I added a unit test, which passes: https://github.com/michield/phplist-plugin-restapi/blob/master/tests/phpunit/restapi.php#L711
I will try to see how it is when the text is added in phpList and consumed from the API
from phplist-plugin-restapi.
I'm running in a Docker.
I check my config, and I found my apache startup script:
#!/bin/sh
TZ=MET-1METDST
export TZ
exec /usr/sbin/apache2ctl -DNO_DETACH
I will remove TZ=MET-1METDST
and test again.
the same error.
My Dockerfile:
FROM phusion/baseimage:0.9.17
CMD ["/sbin/my_init"]
RUN ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime
RUN echo "Asia/Taipei" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata
RUN apt-get update && apt-get install -y \
apache2 libapache2-mod-php5 \
php5-cli php5-curl php5-mysql php5-mcrypt php5-json php5-gd php5-mysql php-mail \
sendmail
# Running additional deamons
RUN mkdir -p /etc/service/httpd/
ADD Dockerconfig/httpd.sh /etc/service/httpd/run
RUN chmod -R 755 /etc/service/
# Clean up APT when done.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
from phplist-plugin-restapi.
I will try to your testing, and check my env again, then try again.
Thank your for help!
from phplist-plugin-restapi.
Hello! @michield
My college found that:
--- a/lists/admin/plugins/restapi/includes/pdo.php
+++ b/lists/admin/plugins/restapi/includes/pdo.php
@@ -15,7 +15,7 @@ class PDO extends \PDO
$dbuser = $GLOBALS['database_user'];
$dbpass = $GLOBALS['database_password'];
$dbname = $GLOBALS['database_name'];
- $dbh = new \PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
+ $dbh = new \PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
$dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
And it works.
from phplist-plugin-restapi.
great, thanks
from phplist-plugin-restapi.
Are you using phpList? Would be cool to update the translation, https://translate.phplist.org/zh_TW/
:hint: :-)
from phplist-plugin-restapi.
from phplist-plugin-restapi.
sure!
I will do the translate on this weekend :-)
from phplist-plugin-restapi.
Related Issues (20)
- Remove passwords from subscriberHandler get methods HOT 1
- Support for bulk operations
- "No function for provided [cmd] found!" when I try to subscribe
- POST <html> from php curl comes escaped - deal with it receiver-side? HOT 6
- SQL Syntax error (SQLSTATE[42000]) with command campaignsGet when setting value to limit or offset parameters
- Sorting is not working with the command campaignsGet
- campaignUpdate: parameter was not defined
- phplist returning 400 bad request? HOT 3
- Structure.md Authentication section is outdated
- Change the GitHub repository description HOT 5
- Request Limitation?
- Namespace HOT 1
- campaignUpdate fails due to busted SQL call
- HTML message links are mangled HOT 1
- Fetch Campaign statistics opened/clicks
- No setting fields HOT 3
- subscriberGetByEmail HOT 3
- 0020235: Rest Api: subscriberUpdateAttributes is not working as per documentation HOT 1
- Duplicate subscriberUpdateAttributes API call HOT 2
- No DB server port or socket from configuration.php set in pdo.php HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phplist-plugin-restapi.